git:master: cfg framework: fix sanity checks (again)

1 message Options
Embed this post
Permalink
Andrei Pelinescu-Onciul

git:master: cfg framework: fix sanity checks (again)

Reply Threaded More More options
Print post
Permalink
Module: sip-router
Branch: master
Commit: e06c100b976cfec7c5b2976a88e9706be4aacf81
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=e06c100b976cfec7c5b2976a88e9706be4aacf81

Author: Andrei Pelinescu-Onciul <[hidden email]>
Committer: Andrei Pelinescu-Onciul <[hidden email]>
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) {


_______________________________________________
sr-dev mailing list
[hidden email]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev