diff options
author | bde <bde@FreeBSD.org> | 1996-08-31 16:52:44 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1996-08-31 16:52:44 +0000 |
commit | 070eb30ca675029e79f93333b60287527efc0906 (patch) | |
tree | d0ca99d3f53a0fe4ea60e83d05baa8825fdd8cc4 /sys/libkern | |
parent | db0af2c4dc8e05c93d178bf31653024d244398bb (diff) | |
download | FreeBSD-src-070eb30ca675029e79f93333b60287527efc0906.zip FreeBSD-src-070eb30ca675029e79f93333b60287527efc0906.tar.gz |
Fixed the easy cases of const poisoning in the kernel. Cosmetic.
Diffstat (limited to 'sys/libkern')
-rw-r--r-- | sys/libkern/scanc.c | 8 | ||||
-rw-r--r-- | sys/libkern/strcmp.c | 4 | ||||
-rw-r--r-- | sys/libkern/strncmp.c | 5 |
3 files changed, 9 insertions, 8 deletions
diff --git a/sys/libkern/scanc.c b/sys/libkern/scanc.c index 7bc3fa0..496b46d 100644 --- a/sys/libkern/scanc.c +++ b/sys/libkern/scanc.c @@ -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); diff --git a/sys/libkern/strcmp.c b/sys/libkern/strcmp.c index c9c397b..48e5635 100644 --- a/sys/libkern/strcmp.c +++ b/sys/libkern/strcmp.c @@ -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)); } diff --git a/sys/libkern/strncmp.c b/sys/libkern/strncmp.c index f209e54..e3c4327 100644 --- a/sys/libkern/strncmp.c +++ b/sys/libkern/strncmp.c @@ -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); |