From: Martin Mares Date: Tue, 1 Jul 2008 10:08:29 +0000 (+0200) Subject: UCW: Constified the lookup table for CF_LOOKUP and CF_BITMAP_LOOKUP. X-Git-Tag: holmes-import~408 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=669b67c13dac4d59bd771a8dc908e2dcfe114845;p=libucw.git UCW: Constified the lookup table for CF_LOOKUP and CF_BITMAP_LOOKUP. --- diff --git a/lib/conf-intr.c b/lib/conf-intr.c index 84f555a2..d27b909d 100644 --- a/lib/conf-intr.c +++ b/lib/conf-intr.c @@ -52,9 +52,9 @@ cf_type_size(enum cf_type type, struct cf_user_type *utype) } static char * -cf_parse_lookup(char *str, int *ptr, char **t) +cf_parse_lookup(char *str, int *ptr, const char * const *t) { - char **n = t; + const char * const *n = t; uns total_len = 0; while (*n && strcasecmp(*n, str)) { total_len += strlen(*n) + 2; diff --git a/lib/conf.h b/lib/conf.h index 80857449..190d4b57 100644 --- a/lib/conf.h +++ b/lib/conf.h @@ -71,7 +71,7 @@ struct cf_item { union cf_union { struct cf_section *sec; // declaration of a section or a list cf_parser *par; // parser function - char **lookup; // NULL-terminated sequence of allowed strings for lookups + const char * const *lookup; // NULL-terminated sequence of allowed strings for lookups struct cf_user_type *utype; // specification of the user-defined type } u; enum cf_class cls:16; // attribute class diff --git a/lib/fb-param.c b/lib/fb-param.c index 854ba78a..8c51927f 100644 --- a/lib/fb-param.c +++ b/lib/fb-param.c @@ -37,7 +37,7 @@ struct cf_section fbpar_cf = { CF_TYPE(struct fb_params), CF_COMMIT(fbpar_cf_commit), CF_ITEMS { - CF_LOOKUP("Type", (int *)F(type), ((char *[]){"std", "direct", "mmap", NULL})), + CF_LOOKUP("Type", (int *)F(type), ((const char * const []){"std", "direct", "mmap", NULL})), CF_UNS("BufSize", F(buffer_size)), CF_UNS("KeepBackBuf", F(keep_back_buf)), CF_UNS("ReadAhead", F(read_ahead)), diff --git a/lib/ipaccess.c b/lib/ipaccess.c index 5dd388cc..26bd1bb0 100644 --- a/lib/ipaccess.c +++ b/lib/ipaccess.c @@ -68,7 +68,7 @@ struct cf_user_type ip_addrmask_type = { struct cf_section ipaccess_cf = { CF_TYPE(struct ipaccess_entry), CF_ITEMS { - CF_LOOKUP("Mode", PTR_TO(struct ipaccess_entry, allow), ((char*[]) { "deny", "allow", NULL })), + CF_LOOKUP("Mode", PTR_TO(struct ipaccess_entry, allow), ((const char* const []) { "deny", "allow", NULL })), CF_USER("IP", PTR_TO(struct ipaccess_entry, addr), &ip_addrmask_type), CF_END }