From: Stephen Hemminger Date: Fri, 15 May 2009 16:47:34 +0000 (-0700) Subject: [cleanup] Allow message tables to be constant X-Git-Tag: frr-2.0-rc1~2298 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=8e4c09307d9eafbbbf7fbffb3d3483287cea169b;p=matthieu%2Ffrr.git [cleanup] Allow message tables to be constant Avoid bugs, and improve cache locality by allowing message lists to be read/only. --- diff --git a/lib/log.c b/lib/log.c index f7a3685139..8c3e2ddce0 100644 --- a/lib/log.c +++ b/lib/log.c @@ -771,7 +771,7 @@ lookup (const struct message *mes, int key) * provided otherwise. */ const char * -mes_lookup (struct message *meslist, int max, int index, const char *none) +mes_lookup (const struct message *meslist, int max, int index, const char *none) { int pos = index - meslist[0].key; diff --git a/lib/log.h b/lib/log.h index 86097919ab..2dd1d31379 100644 --- a/lib/log.h +++ b/lib/log.h @@ -151,7 +151,7 @@ extern int zlog_rotate (struct zlog *); #define LOOKUP(x, y) mes_lookup(x, x ## _max, y, "(no item found)") extern const char *lookup (const struct message *, int); -extern const char *mes_lookup (struct message *meslist, +extern const char *mes_lookup (const struct message *meslist, int max, int index, const char *no_item);