add __UNCONST

This commit is contained in:
christos 2004-07-01 19:04:14 +00:00
parent 3a30736db7
commit 5d1f319c56
5 changed files with 17 additions and 18 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: memchr.c,v 1.6 2003/08/07 16:32:09 agc Exp $ */
/* $NetBSD: memchr.c,v 1.7 2004/07/01 19:04:14 christos Exp $ */
/*-
* Copyright (c) 1990, 1993
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)memchr.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: memchr.c,v 1.6 2003/08/07 16:32:09 agc Exp $");
__RCSID("$NetBSD: memchr.c,v 1.7 2004/07/01 19:04:14 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -59,7 +59,7 @@ memchr(s, c, n)
do {
if (*p++ == c)
return ((void *)(p - 1));
return __UNCONST(p - 1);
} while (--n != 0);
}
return (NULL);

View File

@ -1,4 +1,4 @@
/* $NetBSD: strchr.c,v 1.6 2003/11/01 13:17:01 jdolecek Exp $ */
/* $NetBSD: strchr.c,v 1.7 2004/07/01 19:04:14 christos Exp $ */
/*-
* Copyright (c) 1990, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)index.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: strchr.c,v 1.6 2003/11/01 13:17:01 jdolecek Exp $");
__RCSID("$NetBSD: strchr.c,v 1.7 2004/07/01 19:04:14 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -51,9 +51,9 @@ strchr(p, ch)
{
for (;; ++p) {
if (*p == ch)
return((char *)p);
return __UNCONST(p);
if (!*p)
return((char *)NULL);
return NULL;
}
/* NOTREACHED */
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: strrchr.c,v 1.2 2003/11/01 13:17:01 jdolecek Exp $ */
/* $NetBSD: strrchr.c,v 1.3 2004/07/01 19:04:14 christos Exp $ */
/*
* Copyright (c) 1988, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)rindex.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: strrchr.c,v 1.2 2003/11/01 13:17:01 jdolecek Exp $");
__RCSID("$NetBSD: strrchr.c,v 1.3 2004/07/01 19:04:14 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -54,7 +54,7 @@ strrchr(p, ch)
for (save = NULL;; ++p) {
if (*p == ch)
save = (char *)p;
save = __UNCONST(p);
if (!*p)
return(save);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: strstr.c,v 1.3 2003/08/07 16:32:12 agc Exp $ */
/* $NetBSD: strstr.c,v 1.4 2004/07/01 19:04:14 christos Exp $ */
/*-
* Copyright (c) 1990, 1993
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)strstr.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: strstr.c,v 1.3 2003/08/07 16:32:12 agc Exp $");
__RCSID("$NetBSD: strstr.c,v 1.4 2004/07/01 19:04:14 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -68,6 +68,5 @@ strstr(s, find)
} while (strncmp(s, find, len) != 0);
s--;
}
/* LINTED interface specification */
return ((char *)s);
return __UNCONST(s);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: strtoul.c,v 1.7 2003/08/07 16:32:12 agc Exp $ */
/* $NetBSD: strtoul.c,v 1.8 2004/07/01 19:04:14 christos Exp $ */
/*
* Copyright (c) 1990, 1993
@ -35,7 +35,7 @@
#if 0
static char sccsid[] = "@(#)strtoul.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: strtoul.c,v 1.7 2003/08/07 16:32:12 agc Exp $");
__RCSID("$NetBSD: strtoul.c,v 1.8 2004/07/01 19:04:14 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -121,7 +121,7 @@ strtoul(nptr, endptr, base)
if (acc > cutoff || (acc == cutoff && c > cutlim)) {
#if defined(_KERNEL) || defined(_STANDALONE)
if (endptr)
*endptr = (char *) nptr;
*endptr = __UNCONST(nptr);
return ULONG_MAX;
#else
any = -1;
@ -138,6 +138,6 @@ strtoul(nptr, endptr, base)
acc = -acc;
if (endptr != NULL)
/* LINTED interface specification */
*endptr = (char *)(any ? s - 1 : nptr);
*endptr = __UNCONST(any ? s - 1 : nptr);
return (acc);
}