From 54b03a17276439a24a81d7f55e6d43c92f22637e Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Wed, 3 May 2023 14:58:06 +0300 Subject: [PATCH] [acc] removed old workaround multiple int2str() in acc_extra Since 2.3 we actually do not need this, as each acc_extra is individually set into its own buffer. Related to 6c0b37f907d30749266e2deca3c9ccc475dd32e4 --- modules/acc/acc_extra.c | 28 ++-------------------------- modules/acc/acc_extra.h | 2 -- modules/acc/acc_mod.c | 3 --- 3 files changed, 2 insertions(+), 31 deletions(-) diff --git a/modules/acc/acc_extra.c b/modules/acc/acc_extra.c index 8513fcb4ac7..ce467f333ac 100644 --- a/modules/acc/acc_extra.c +++ b/modules/acc/acc_extra.c @@ -73,24 +73,9 @@ extern tag_t* leg_tags; static const str tag_delim = str_init("->"); -/* here we copy the strings returned by int2str (which uses a static buffer) */ -static char int_buf[MAX_ACC_BUFS][INT2STR_MAX_LEN*MAX_ACC_INT_BUF]; - -static char* static_detector[2] = {NULL,NULL}; - typedef struct acc_extra** (*str2bkend)(str*); -void init_acc_extra(void) -{ - int i; - /* ugly trick to get the address of the static buffer */ - static_detector[0] = int2str( (unsigned long)3, &i) + i; - /* remember directly the static buffer returned by ip_addr2a()*/ - static_detector[1] = _ip_addr_A_buffs[0]; -} - - /* * insert a tag int the tags vector * @param tag to insert(str value) @@ -528,14 +513,13 @@ int extra2int( struct acc_extra *extra, int *attrs ) int extra2strar( extra_value_t* values, str *val_arr, int idx) { int n; - int r; if (idx < 0 || idx > MAX_ACC_BUFS-2 /* last one is for legs */) { LM_ERR("Invalid buffer index %d - maximum %d\n", idx, MAX_ACC_BUFS-2); return 0; } - for( n=0,r=0 ; n < extra_tgs_len ; n++) { + for( n=0 ; n < extra_tgs_len ; n++) { /* get the value */ /* check for overflow */ if (n==MAX_ACC_EXTRA) { @@ -549,15 +533,7 @@ int extra2strar( extra_value_t* values, str *val_arr, int idx) val_arr[n].len = 0; } else { /* set the value into the acc buffer */ - if (values[n].value.s+values[n].value.len==static_detector[0] || - values[n].value.s==static_detector[1]) { - val_arr[n].s = int_buf[idx] + r*INT2STR_MAX_LEN; - val_arr[n].len = values[n].value.len; - memcpy(val_arr[n].s, values[n].value.s, values[n].value.len); - r++; - } else { - val_arr[n] = values[n].value; - } + val_arr[n] = values[n].value; } } diff --git a/modules/acc/acc_extra.h b/modules/acc/acc_extra.h index 18246f135c9..091fbc17db9 100644 --- a/modules/acc/acc_extra.h +++ b/modules/acc/acc_extra.h @@ -67,8 +67,6 @@ typedef str tag_t; #define MAX_ACC_BUFS 3 -void init_acc_extra(); - int parse_acc_extra(modparam_t type, void* val); int build_acc_extra_array(int tags_len, extra_value_t** array_p); diff --git a/modules/acc/acc_mod.c b/modules/acc/acc_mod.c index 76f4431c204..179bea2334a 100644 --- a/modules/acc/acc_mod.c +++ b/modules/acc/acc_mod.c @@ -362,9 +362,6 @@ static int mod_init( void ) } } - /* init the extra engine */ - init_acc_extra(); - /* ----------- SYSLOG INIT SECTION ----------- */ acc_log_init();