Skip to content

Commit 54b03a1

Browse files
committed
[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 6c0b37f
1 parent 1ec041d commit 54b03a1

File tree

3 files changed

+2
-31
lines changed

3 files changed

+2
-31
lines changed

modules/acc/acc_extra.c

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -73,24 +73,9 @@ extern tag_t* leg_tags;
7373

7474
static const str tag_delim = str_init("->");
7575

76-
/* here we copy the strings returned by int2str (which uses a static buffer) */
77-
static char int_buf[MAX_ACC_BUFS][INT2STR_MAX_LEN*MAX_ACC_INT_BUF];
78-
79-
static char* static_detector[2] = {NULL,NULL};
80-
8176
typedef struct acc_extra** (*str2bkend)(str*);
8277

8378

84-
void init_acc_extra(void)
85-
{
86-
int i;
87-
/* ugly trick to get the address of the static buffer */
88-
static_detector[0] = int2str( (unsigned long)3, &i) + i;
89-
/* remember directly the static buffer returned by ip_addr2a()*/
90-
static_detector[1] = _ip_addr_A_buffs[0];
91-
}
92-
93-
9479
/*
9580
* insert a tag int the tags vector
9681
* @param tag to insert(str value)
@@ -528,14 +513,13 @@ int extra2int( struct acc_extra *extra, int *attrs )
528513
int extra2strar( extra_value_t* values, str *val_arr, int idx)
529514
{
530515
int n;
531-
int r;
532516

533517
if (idx < 0 || idx > MAX_ACC_BUFS-2 /* last one is for legs */) {
534518
LM_ERR("Invalid buffer index %d - maximum %d\n", idx, MAX_ACC_BUFS-2);
535519
return 0;
536520
}
537521

538-
for( n=0,r=0 ; n < extra_tgs_len ; n++) {
522+
for( n=0 ; n < extra_tgs_len ; n++) {
539523
/* get the value */
540524
/* check for overflow */
541525
if (n==MAX_ACC_EXTRA) {
@@ -549,15 +533,7 @@ int extra2strar( extra_value_t* values, str *val_arr, int idx)
549533
val_arr[n].len = 0;
550534
} else {
551535
/* set the value into the acc buffer */
552-
if (values[n].value.s+values[n].value.len==static_detector[0] ||
553-
values[n].value.s==static_detector[1]) {
554-
val_arr[n].s = int_buf[idx] + r*INT2STR_MAX_LEN;
555-
val_arr[n].len = values[n].value.len;
556-
memcpy(val_arr[n].s, values[n].value.s, values[n].value.len);
557-
r++;
558-
} else {
559-
val_arr[n] = values[n].value;
560-
}
536+
val_arr[n] = values[n].value;
561537
}
562538
}
563539

modules/acc/acc_extra.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@ typedef str tag_t;
6767
#define MAX_ACC_BUFS 3
6868

6969

70-
void init_acc_extra();
71-
7270
int parse_acc_extra(modparam_t type, void* val);
7371

7472
int build_acc_extra_array(int tags_len, extra_value_t** array_p);

modules/acc/acc_mod.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -362,9 +362,6 @@ static int mod_init( void )
362362
}
363363
}
364364

365-
/* init the extra engine */
366-
init_acc_extra();
367-
368365
/* ----------- SYSLOG INIT SECTION ----------- */
369366
acc_log_init();
370367

0 commit comments

Comments
 (0)