diff options
author | jilles <jilles@FreeBSD.org> | 2012-02-22 21:47:50 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2012-02-22 21:47:50 +0000 |
commit | f4082dbf79c8000ffd0300062337527467aa8622 (patch) | |
tree | 9f5458160514be5b2024e7c5ae168d4ef498a618 /lib | |
parent | ee11c1015855a0cfddf445843363941e0feaec31 (diff) | |
download | FreeBSD-src-f4082dbf79c8000ffd0300062337527467aa8622.zip FreeBSD-src-f4082dbf79c8000ffd0300062337527467aa8622.tar.gz |
libc: Eliminate some relative relocations in fmtmsg().
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/gen/fmtmsg.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/libc/gen/fmtmsg.c b/lib/libc/gen/fmtmsg.c index e6b1b96..c6ecbd5 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++; } } |