Module: sip-router
Branch: tirpi/cfg_framework_multivalue
Commit: b4e2f2aa59257ef26aeec1558ebd9aa76c61d60d
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=b4e2f2a…
Author: Miklos Tirpak <miklos(a)iptel.org>
Committer: Miklos Tirpak <miklos(a)iptel.org>
Date: Tue Sep 28 17:14:37 2010 +0200
cfg framework: translate_pointer bugfix
The parameters of translate_pointer() need to be casted to char*.
It would be much more convenient, and also safer, to do this
casting within the macro.
---
cfg/cfg_ctx.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/cfg/cfg_ctx.c b/cfg/cfg_ctx.c
index 8b79197..606ab6b 100644
--- a/cfg/cfg_ctx.c
+++ b/cfg/cfg_ctx.c
@@ -286,7 +286,9 @@ static int cfg_update_defaults(cfg_group_meta_t *meta,
/* The array needs to be cloned before the modification */
if (!(array = cfg_clone_array(meta, group)))
return -1;
- ginst = translate_pointer(array, meta->array, ginst);
+ ginst = (cfg_group_inst_t *)translate_pointer((char *)array,
+ (char *)meta->array,
+ (char *)ginst);
/* re-link the array to the meta-data */
meta->array = array;
clone_done = 1;
@@ -459,9 +461,9 @@ int cfg_set_now(cfg_ctx_t *ctx, str *group_name, unsigned int
*group_id, str *va
* the complete config block and this array is replaced. */
if (!(new_array = cfg_clone_array(CFG_GROUP_META(*cfg_global, group), group)))
goto error;
- group_inst = translate_pointer(new_array,
- CFG_GROUP_META(*cfg_global, group)->array,
- group_inst);
+ group_inst = (cfg_group_inst_t *)translate_pointer((char *)new_array,
+ (char *)CFG_GROUP_META(*cfg_global, group)->array,
+ (char *)group_inst);
var_block = group_inst->vars;
CFG_GROUP_META(block, group)->array = new_array;
} else {