Module: sip-router
Branch: master
Commit: e06c100b976cfec7c5b2976a88e9706be4aacf81
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=e06c100…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Fri Jul 3 18:28:38 2009 +0200
cfg framework: fix sanity checks (again)
The previous sanity check fix wrongly assumed that CFG_VAR_MASK
would return 1<<type and not type.
---
cfg/cfg.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/cfg/cfg.c b/cfg/cfg.c
index acc0ea3..a881fc2 100644
--- a/cfg/cfg.c
+++ b/cfg/cfg.c
@@ -66,7 +66,7 @@ int cfg_declare(char *group_name, cfg_def_t *def, void *values, int
def_size,
mapping[i].def = &(def[i]);
mapping[i].name_len = strlen(def[i].name);
/* record all the types for sanity checks */
- types|=CFG_VAR_MASK(def[i].type);
+ types|=1 << CFG_VAR_MASK(def[i].type);
/* padding depends on the type of the next variable */
switch (CFG_VAR_MASK(def[i].type)) {
@@ -133,7 +133,7 @@ int cfg_declare(char *group_name, cfg_def_t *def, void *values, int
def_size,
/* fix the computed size (char*, str or pointer members will force
structure padding to multiple of sizeof(pointer)) */
- if (types & (CFG_VAR_STRING|CFG_VAR_STR|CFG_VAR_POINTER))
+ if (types &
((1<<CFG_VAR_STRING)|(1<<CFG_VAR_STR)|(1<<CFG_VAR_POINTER)))
size=ROUND_POINTER(size);
/* minor validation */
if (size != def_size) {