diff options
| author | christos <christos@NetBSD.org> | 2008-02-23 15:18:04 +0000 |
|---|---|---|
| committer | christos <christos@NetBSD.org> | 2008-02-23 15:18:04 +0000 |
| commit | 8fbaff10052cd6ecebbf0240cf9b0926e3c09b79 (patch) | |
| tree | 274f683fb952445aefb09e0ca3f08e326a8c7b52 /lib/libc/string | |
| parent | 686921623977ec9bbb079b4cc7019a075d2f09e8 (diff) | |
fix lint issues.
Diffstat (limited to 'lib/libc/string')
| -rw-r--r-- | lib/libc/string/strcspn.c | 16 | ||||
| -rw-r--r-- | lib/libc/string/strpbrk.c | 16 | ||||
| -rw-r--r-- | lib/libc/string/strspn.c | 16 |
3 files changed, 21 insertions, 27 deletions
diff --git a/lib/libc/string/strcspn.c b/lib/libc/string/strcspn.c index 0d0f8cb9d94..46b1c51ad11 100644 --- a/lib/libc/string/strcspn.c +++ b/lib/libc/string/strcspn.c @@ -1,4 +1,4 @@ -/* $NetBSD: strcspn.c,v 1.13 2008/02/22 19:25:59 joerg Exp $ */ +/* $NetBSD: strcspn.c,v 1.14 2008/02/23 15:18:04 christos Exp $ */ /*- * Copyright (c) 2008 Joerg Sonnenberger @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: strcspn.c,v 1.13 2008/02/22 19:25:59 joerg Exp $"); +__RCSID("$NetBSD: strcspn.c,v 1.14 2008/02/23 15:18:04 christos Exp $"); #include <assert.h> #include <inttypes.h> @@ -38,20 +38,18 @@ strcspn(const char *s, const char *charset) static const size_t idx[8] = { 1, 2, 4, 8, 16, 32, 64, 128 }; const char *t; uint8_t set[32]; +#define UC(a) ((unsigned int)(unsigned char)(a)) _DIAGASSERT(s != NULL); _DIAGASSERT(charset != NULL); - memset(set, 0, sizeof(set)); + (void)memset(set, 0, sizeof(set)); for (; *charset != '\0'; ++charset) - set[(unsigned char)*charset >> 3] |= - idx[(unsigned char)*charset & 7]; + set[UC(*charset) >> 3] |= idx[UC(*charset) & 7]; - for (t = s; *t != '\0'; ++t) { - if (set[(unsigned char)*s >> 3] & - idx[(unsigned char)*s & 7]) + for (t = s; *t != '\0'; ++t) + if (set[UC(*s) >> 3] & idx[UC(*s) & 7]) break; - } return t - s; } diff --git a/lib/libc/string/strpbrk.c b/lib/libc/string/strpbrk.c index 6d18fdc4aa3..46fb0210449 100644 --- a/lib/libc/string/strpbrk.c +++ b/lib/libc/string/strpbrk.c @@ -1,4 +1,4 @@ -/* $NetBSD: strpbrk.c,v 1.15 2008/02/22 19:25:59 joerg Exp $ */ +/* $NetBSD: strpbrk.c,v 1.16 2008/02/23 15:18:04 christos Exp $ */ /*- * Copyright (c) 2008 Joerg Sonnenberger @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: strpbrk.c,v 1.15 2008/02/22 19:25:59 joerg Exp $"); +__RCSID("$NetBSD: strpbrk.c,v 1.16 2008/02/23 15:18:04 christos Exp $"); #include <assert.h> #include <inttypes.h> @@ -38,20 +38,18 @@ strpbrk(const char *s, const char *charset) { static const size_t idx[8] = { 1, 2, 4, 8, 16, 32, 64, 128 }; uint8_t set[32]; +#define UC(a) ((unsigned int)(unsigned char)(a)) _DIAGASSERT(s != NULL); _DIAGASSERT(charset != NULL); - memset(set, 0, sizeof(set)); + (void)memset(set, 0, sizeof(set)); for (; *charset != '\0'; ++charset) - set[(unsigned char)*charset >> 3] |= - idx[(unsigned char)*charset & 7]; + set[UC(*charset) >> 3] |= idx[UC(*charset) & 7]; - for (; *s != '\0'; ++s) { - if (set[(unsigned char)*s >> 3] & - idx[(unsigned char)*s & 7]) + for (; *s != '\0'; ++s) + if (set[UC(*s) >> 3] & idx[UC(*s) & 7]) return __UNCONST(s); - } return NULL; } diff --git a/lib/libc/string/strspn.c b/lib/libc/string/strspn.c index 94e85df5a61..64d9c5c9a71 100644 --- a/lib/libc/string/strspn.c +++ b/lib/libc/string/strspn.c @@ -1,4 +1,4 @@ -/* $NetBSD: strspn.c,v 1.13 2008/02/22 19:25:59 joerg Exp $ */ +/* $NetBSD: strspn.c,v 1.14 2008/02/23 15:18:04 christos Exp $ */ /*- * Copyright (c) 2008 Joerg Sonnenberger @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: strspn.c,v 1.13 2008/02/22 19:25:59 joerg Exp $"); +__RCSID("$NetBSD: strspn.c,v 1.14 2008/02/23 15:18:04 christos Exp $"); #include <assert.h> #include <inttypes.h> @@ -39,20 +39,18 @@ strspn(const char *s, const char *charset) static const size_t idx[8] = { 1, 2, 4, 8, 16, 32, 64, 128 }; uint8_t set[32]; const char *t; +#define UC(a) ((unsigned int)(unsigned char)(a)) _DIAGASSERT(s != NULL); _DIAGASSERT(charset != NULL); - memset(set, 0, sizeof(set)); + (void)memset(set, 0, sizeof(set)); for (; *charset != '\0'; ++charset) - set[(unsigned char)*charset >> 3] |= - idx[(unsigned char)*charset & 7]; + set[UC(*charset) >> 3] |= idx[UC(*charset) & 7]; - for (t = s; *t != '\0'; ++t) { - if ((set[(unsigned char)*s >> 3] & - idx[(unsigned char)*s & 7]) == 0) + for (t = s; *t != '\0'; ++t) + if ((set[UC(*s) >> 3] & idx[UC(*s) & 7]) == 0) break; - } return t - s; } |
