Fixed the easy cases of const poisoning in the kernel. Cosmetic.
This commit is contained in:
parent
b316c8b2a7
commit
e0c95ed947
@ -51,5 +51,5 @@ strcmp(s1, s2)
|
||||
while (*s1 == *s2++)
|
||||
if (*s1++ == 0)
|
||||
return (0);
|
||||
return (*(unsigned char *)s1 - *(unsigned char *)--s2);
|
||||
return (*(const unsigned char *)s1 - *(const unsigned char *)(s2 - 1));
|
||||
}
|
||||
|
@ -48,7 +48,8 @@ strncmp(s1, s2, n)
|
||||
return (0);
|
||||
do {
|
||||
if (*s1 != *s2++)
|
||||
return (*(unsigned char *)s1 - *(unsigned char *)--s2);
|
||||
return (*(const unsigned char *)s1 -
|
||||
*(const unsigned char *)(s2 - 1));
|
||||
if (*s1++ == 0)
|
||||
break;
|
||||
} while (--n != 0);
|
||||
|
@ -36,7 +36,7 @@
|
||||
*
|
||||
* @(#)procfs_subr.c 8.4 (Berkeley) 1/27/94
|
||||
*
|
||||
* $Id: procfs_subr.c,v 1.8 1996/06/18 05:15:59 dyson Exp $
|
||||
* $Id: procfs_subr.c,v 1.9 1996/07/02 13:38:10 dyson Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -340,7 +340,7 @@ vfs_findname(nm, buf, buflen)
|
||||
int buflen;
|
||||
{
|
||||
for (; nm->nm_name; nm++)
|
||||
if (bcmp(buf, (char *) nm->nm_name, buflen+1) == 0)
|
||||
if (bcmp(buf, nm->nm_name, buflen+1) == 0)
|
||||
return (nm);
|
||||
|
||||
return (0);
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: imgact_aout.c,v 1.27 1996/05/01 02:42:41 bde Exp $
|
||||
* $Id: imgact_aout.c,v 1.28 1996/05/02 10:43:16 phk Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -52,7 +52,7 @@ static int
|
||||
exec_aout_imgact(imgp)
|
||||
struct image_params *imgp;
|
||||
{
|
||||
struct exec *a_out = (struct exec *) imgp->image_header;
|
||||
const struct exec *a_out = (const struct exec *) imgp->image_header;
|
||||
struct vmspace *vmspace = imgp->proc->p_vmspace;
|
||||
vm_offset_t vmaddr;
|
||||
unsigned long virtual_offset;
|
||||
|
@ -26,7 +26,7 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: imgact_elf.c,v 1.6 1996/06/12 05:07:25 gpalmer Exp $
|
||||
* $Id: imgact_elf.c,v 1.7 1996/06/18 05:15:46 dyson Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -67,7 +67,7 @@
|
||||
static int map_pages __P((struct vnode *vp, vm_offset_t offset, vm_offset_t *buf, vm_size_t size));
|
||||
static void unmap_pages __P((struct vnode *vp, vm_offset_t buf, vm_size_t size));
|
||||
static int elf_check_permissions __P((struct proc *p, struct vnode *vp));
|
||||
static int elf_check_header __P((Elf32_Ehdr *hdr, int type));
|
||||
static int elf_check_header __P((const Elf32_Ehdr *hdr, int type));
|
||||
static int elf_load_section __P((struct vmspace *vmspace, struct vnode *vp, vm_offset_t offset, caddr_t vmaddr, size_t memsz, size_t filsz, vm_prot_t prot));
|
||||
static int elf_load_file __P((struct proc *p, char *file, u_long *addr, u_long *entry));
|
||||
static int elf_freebsd_fixup __P((int **stack_base, struct image_params *imgp));
|
||||
@ -237,7 +237,7 @@ elf_check_permissions(struct proc *p, struct vnode *vp)
|
||||
}
|
||||
|
||||
static int
|
||||
elf_check_header(Elf32_Ehdr *hdr, int type)
|
||||
elf_check_header(const Elf32_Ehdr *hdr, int type)
|
||||
{
|
||||
if (!(hdr->e_ident[EI_MAG0] == ELFMAG0 &&
|
||||
hdr->e_ident[EI_MAG1] == ELFMAG1 &&
|
||||
@ -468,8 +468,8 @@ fail:
|
||||
int
|
||||
exec_elf_imgact(struct image_params *imgp)
|
||||
{
|
||||
Elf32_Ehdr *hdr = (Elf32_Ehdr *) imgp->image_header;
|
||||
Elf32_Phdr *phdr, *mapped_phdr = NULL;
|
||||
const Elf32_Ehdr *hdr = (const Elf32_Ehdr *) imgp->image_header;
|
||||
const Elf32_Phdr *phdr, *mapped_phdr = NULL;
|
||||
Elf32_Auxargs *elf_auxargs = NULL;
|
||||
struct vmspace *vmspace = imgp->proc->p_vmspace;
|
||||
vm_prot_t prot = 0;
|
||||
@ -514,8 +514,8 @@ exec_elf_imgact(struct image_params *imgp)
|
||||
*/
|
||||
phdr = mapped_phdr;
|
||||
} else {
|
||||
phdr = (Elf32_Phdr*)
|
||||
((char*)(imgp->image_header)+hdr->e_phoff);
|
||||
phdr = (const Elf32_Phdr*)
|
||||
((const char *)imgp->image_header + hdr->e_phoff);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -6,7 +6,7 @@
|
||||
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
|
||||
* ----------------------------------------------------------------------------
|
||||
*
|
||||
* $Id: imgact_gzip.c,v 1.22 1996/05/02 10:43:16 phk Exp $
|
||||
* $Id: imgact_gzip.c,v 1.23 1996/08/01 22:00:14 phk Exp $
|
||||
*
|
||||
* This module handles execution of a.out files which have been run through
|
||||
* "gzip". This saves diskspace, but wastes cpu-cycles and VM.
|
||||
@ -66,7 +66,7 @@ exec_gzip_imgact(imgp)
|
||||
struct image_params *imgp;
|
||||
{
|
||||
int error, error2 = 0;
|
||||
u_char *p = (u_char *) imgp->image_header;
|
||||
const u_char *p = (const u_char *) imgp->image_header;
|
||||
struct imgact_gzip igz;
|
||||
struct inflate infl;
|
||||
struct vmspace *vmspace;
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: imgact_shell.c,v 1.10 1995/12/02 16:32:03 bde Exp $
|
||||
* $Id: imgact_shell.c,v 1.11 1996/04/08 01:21:58 davidg Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -58,7 +58,7 @@ exec_shell_imgact(imgp)
|
||||
char *interp;
|
||||
|
||||
/* a shell script? */
|
||||
if (((short *) image_header)[0] != SHELLMAGIC)
|
||||
if (((const short *) image_header)[0] != SHELLMAGIC)
|
||||
return(-1);
|
||||
|
||||
/*
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)subr_prf.c 8.3 (Berkeley) 1/21/94
|
||||
* $Id: subr_prf.c,v 1.37 1996/05/09 18:58:06 gpalmer Exp $
|
||||
* $Id: subr_prf.c,v 1.38 1996/08/19 20:07:07 julian Exp $
|
||||
*/
|
||||
|
||||
#include "opt_ddb.h"
|
||||
@ -390,14 +390,14 @@ kvprintf(char const *fmt, void (*func)(int, void*), void *arg, int radix, va_lis
|
||||
for (;;) {
|
||||
padc = ' ';
|
||||
width = 0;
|
||||
while ((ch = *(u_char *)fmt++) != '%') {
|
||||
while ((ch = (u_char)*fmt++) != '%') {
|
||||
if (ch == '\0')
|
||||
return retval;
|
||||
PCHAR(ch);
|
||||
}
|
||||
lflag = 0; ladjust = 0; sharpflag = 0; neg = 0;
|
||||
sign = 0; dot = 0; dwidth = 0;
|
||||
reswitch: switch (ch = *(u_char *)fmt++) {
|
||||
reswitch: switch (ch = (u_char)*fmt++) {
|
||||
case '.':
|
||||
dot = 1;
|
||||
goto reswitch;
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)tty.c 8.8 (Berkeley) 1/21/94
|
||||
* $Id: tty.c,v 1.82 1996/06/12 05:07:33 gpalmer Exp $
|
||||
* $Id: tty.c,v 1.83 1996/08/28 18:45:09 bde Exp $
|
||||
*/
|
||||
|
||||
/*-
|
||||
@ -135,7 +135,7 @@ static int ttywflush __P((struct tty *tp));
|
||||
#define TB TAB
|
||||
#define VT VTAB
|
||||
|
||||
static char const char_type[] = {
|
||||
static u_char const char_type[] = {
|
||||
E|CC, O|CC, O|CC, E|CC, O|CC, E|CC, E|CC, O|CC, /* nul - bel */
|
||||
O|BS, E|TB, E|NL, O|CC, E|VT, O|CR, O|CC, E|CC, /* bs - si */
|
||||
O|CC, E|CC, E|CC, O|CC, E|CC, O|CC, O|CC, E|CC, /* dle - etb */
|
||||
@ -1816,7 +1816,7 @@ loop:
|
||||
ce = cc;
|
||||
else {
|
||||
ce = cc - scanc((u_int)cc, (u_char *)cp,
|
||||
(u_char *)char_type, CCLASSMASK);
|
||||
char_type, CCLASSMASK);
|
||||
/*
|
||||
* If ce is zero, then we're processing
|
||||
* a special character through ttyoutput.
|
||||
|
@ -32,7 +32,7 @@
|
||||
*
|
||||
* @(#)scanc.c 8.1 (Berkeley) 6/10/93
|
||||
*
|
||||
* $Id: scanc.c,v 1.3 1995/03/17 06:15:39 phk Exp $
|
||||
* $Id: scanc.c,v 1.4 1995/07/11 18:50:47 bde Exp $
|
||||
*/
|
||||
|
||||
#include <sys/libkern.h>
|
||||
@ -40,10 +40,10 @@
|
||||
int
|
||||
scanc(size, cp, table, mask0)
|
||||
u_int size;
|
||||
register u_char *cp, table[];
|
||||
register const u_char *cp, table[];
|
||||
int mask0;
|
||||
{
|
||||
register u_char *end;
|
||||
register const u_char *end;
|
||||
register u_char mask;
|
||||
|
||||
mask = mask0;
|
||||
@ -53,7 +53,7 @@ scanc(size, cp, table, mask0)
|
||||
* The cast to volatile should have no effect, but in fact it
|
||||
* improves the code on i386's.
|
||||
*/
|
||||
if (table[*(volatile u_char *)cp] & mask)
|
||||
if (table[*(volatile const u_char *)cp] & mask)
|
||||
break;
|
||||
}
|
||||
return (end - cp);
|
||||
|
@ -33,7 +33,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: strcmp.c,v 1.2 1994/08/02 07:44:33 davidg Exp $
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
@ -49,5 +49,5 @@ strcmp(s1, s2)
|
||||
while (*s1 == *s2++)
|
||||
if (*s1++ == 0)
|
||||
return (0);
|
||||
return (*(unsigned char *)s1 - *(unsigned char *)--s2);
|
||||
return (*(const unsigned char *)s1 - *(const unsigned char *)(s2 - 1));
|
||||
}
|
||||
|
@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: strncmp.c,v 1.2 1996/08/28 20:32:21 bde Exp $
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
@ -46,7 +46,8 @@ strncmp(s1, s2, n)
|
||||
return (0);
|
||||
do {
|
||||
if (*s1 != *s2++)
|
||||
return (*(unsigned char *)s1 - *(unsigned char *)--s2);
|
||||
return (*(const unsigned char *)s1 -
|
||||
*(const unsigned char *)(s2 - 1));
|
||||
if (*s1++ == 0)
|
||||
break;
|
||||
} while (--n != 0);
|
||||
|
@ -36,7 +36,7 @@
|
||||
*
|
||||
* @(#)procfs_subr.c 8.4 (Berkeley) 1/27/94
|
||||
*
|
||||
* $Id: procfs_subr.c,v 1.8 1996/06/18 05:15:59 dyson Exp $
|
||||
* $Id: procfs_subr.c,v 1.9 1996/07/02 13:38:10 dyson Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -340,7 +340,7 @@ vfs_findname(nm, buf, buflen)
|
||||
int buflen;
|
||||
{
|
||||
for (; nm->nm_name; nm++)
|
||||
if (bcmp(buf, (char *) nm->nm_name, buflen+1) == 0)
|
||||
if (bcmp(buf, nm->nm_name, buflen+1) == 0)
|
||||
return (nm);
|
||||
|
||||
return (0);
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)libkern.h 8.1 (Berkeley) 6/10/93
|
||||
* $Id: libkern.h,v 1.11 1996/06/08 06:32:48 nate Exp $
|
||||
* $Id: libkern.h,v 1.12 1996/08/01 20:31:45 wollman Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_LIBKERN_H_
|
||||
@ -74,7 +74,7 @@ void qsort __P((void *base, size_t nmemb, size_t size,
|
||||
u_long random __P((void));
|
||||
char *index __P((const char *, int));
|
||||
char *rindex __P((const char *, int));
|
||||
int scanc __P((u_int, u_char *, u_char *, int));
|
||||
int scanc __P((u_int, const u_char *, const u_char *, int));
|
||||
int skpc __P((int, int, char *));
|
||||
char *strcat __P((char *, const char *));
|
||||
int strcmp __P((const char *, const char *));
|
||||
|
Loading…
x
Reference in New Issue
Block a user