aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJilles Tjoelker <jilles@FreeBSD.org>2012-02-22 21:47:50 +0000
committerJilles Tjoelker <jilles@FreeBSD.org>2012-02-22 21:47:50 +0000
commit8b34578da794129fed6d4fbf3631f62f54256f5a (patch)
tree9f5458160514be5b2024e7c5ae168d4ef498a618 /lib
parentfb53214d2837a4726eae0101a90390ac399cfe9e (diff)
downloadsrc-8b34578da794129fed6d4fbf3631f62f54256f5a.tar.gz
src-8b34578da794129fed6d4fbf3631f62f54256f5a.zip
libc: Eliminate some relative relocations in fmtmsg().
Notes
Notes: svn path=/head/; revision=232007
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/gen/fmtmsg.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/libc/gen/fmtmsg.c b/lib/libc/gen/fmtmsg.c
index e6b1b960d64b..c6ecbd5f7653 100644
--- a/lib/libc/gen/fmtmsg.c
+++ b/lib/libc/gen/fmtmsg.c
@@ -45,10 +45,6 @@ static const char
*sevinfo(int);
static int validmsgverb(const char *);
-static const char *validlist[] = {
- "label", "severity", "text", "action", "tag", NULL
-};
-
int
fmtmsg(long class, const char *label, int sev, const char *text,
const char *action, const char *tag)
@@ -205,14 +201,18 @@ sevinfo(int sev)
static int
validmsgverb(const char *msgverb)
{
+ const char *validlist = "label\0severity\0text\0action\0tag\0";
char *msgcomp;
- int i, equality;
+ size_t len1, len2;
+ const char *p;
+ int equality;
equality = 0;
while ((msgcomp = nextcomp(msgverb)) != NULL) {
equality--;
- for (i = 0; validlist[i] != NULL; i++) {
- if (strcmp(msgcomp, validlist[i]) == 0)
+ len1 = strlen(msgcomp);
+ for (p = validlist; (len2 = strlen(p)) != 0; p += len2 + 1) {
+ if (len1 == len2 && memcmp(msgcomp, p, len1) == 0)
equality++;
}
}