From: Robert Spalek Date: Wed, 26 Apr 2006 09:09:17 +0000 (+0200) Subject: conf2: lookup tables are byte** instead of char** X-Git-Tag: holmes-import~645^2~11^2~34 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=b8ff2afe00e7795f8ea8800fc2ce86eeeff0a9b9;p=libucw.git conf2: lookup tables are byte** instead of char** --- diff --git a/lib/conf2.c b/lib/conf2.c index 8eb433d1..0d6d4eb5 100644 --- a/lib/conf2.c +++ b/lib/conf2.c @@ -591,9 +591,9 @@ cf_parse_string(byte *str, byte **ptr) } static byte * -cf_parse_lookup(byte *str, int *ptr, char **t) +cf_parse_lookup(byte *str, int *ptr, byte **t) { - char **n = t; + byte **n = t; uns total_len = 0; while (*n && strcasecmp(*n, str)) { total_len += strlen(*n) + 2; @@ -1423,7 +1423,7 @@ dump_basic(struct fastbuf *fb, void *ptr, enum cf_type type, union cf_union *u) case CT_DOUBLE: bprintf(fb, "%lg ", *(double*)ptr); break; case CT_IP: bprintf(fb, "%08x ", *(uns*)ptr); break; case CT_STRING: bprintf(fb, "'%s' ", *(byte**)ptr); break; - case CT_LOOKUP: bprintf(fb, "%s ", *(int*)ptr >= 0 ? u->lookup[ *(int*)ptr ] : "???"); break; + case CT_LOOKUP: bprintf(fb, "%s ", *(int*)ptr >= 0 ? u->lookup[ *(int*)ptr ] : (byte*) "???"); break; case CT_USER: if (u->utype->dumper) u->utype->dumper(fb, ptr); diff --git a/lib/conf2.h b/lib/conf2.h index 737c285d..0021f3f2 100644 --- a/lib/conf2.h +++ b/lib/conf2.h @@ -65,7 +65,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 + byte **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/ipaccess.c b/lib/ipaccess.c index 910715e7..3323d0a7 100644 --- a/lib/ipaccess.c +++ b/lib/ipaccess.c @@ -61,7 +61,7 @@ static struct cf_user_type 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), ((byte*[]) { "deny", "allow", NULL })), CF_USER("IP", PTR_TO(struct ipaccess_entry, addr), &addrmask_type), CF_END }