Hello
I’m trying to use function xavp_rm_by_index to remove a specific index from a given xavp.
I’m observing an unexpected behaviour, I think it might be a bug :
Instead of just removing the index, the function removes the index and all others before it.
E.g : if called with « idx = 1 », it removes indexes 0 and 1.
Reading the code of xavp_rm_internal (which is called by xavp_rm_by_index), I don’t think it behaves at it should :
/* Remove xavps
* idx: <0 remove all xavps with the same name
* >=0 remove only the specified index xavp
* Returns number of xavps that were deleted
*/
For example when I do this :
LM_ERR("COUNT BEFORE: %d\n", xavp_count(rname, NULL));
int rm_count = xavp_rm_by_index(rname, 1, NULL); // TEST
LM_ERR("REMOVED: %d\n", rm_count);
LM_ERR("COUNT AFTER: %d\n", xavp_count(rname, NULL));
« rm_count » returned is 1 (which is expected). However, « count after » is decremented by 2.
And when I look at the contents of my xavp, I notice that the first two elements have been removed.
Likewise if xavp_rm_by_index is invoked with idx = 2 => the first 3 elements are removed.
So… do you think this is a bug ? or something I didn’t understand ?
Thanks for your help !
Regards,
Nicolas.