MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / remove_msg_branch

Function remove_msg_branch

dset.c:459–484  ·  view source on GitHub ↗

! \brief * Removes a msg branch by index. The whole array gets shifted, so the * indexes inside may change */

Source from the content-addressed store, hash-verified

457 * indexes inside may change
458 */
459int remove_msg_branch(unsigned int idx)
460{
461 struct dset_ctx *dsct = get_dset_ctx();
462 int i;
463
464 if (!dsct || !dsct->enabled || idx >= dsct->nr_branches)
465 return -1;
466
467 /* destroy any attrs the branch may have */
468 destroy_avp_list( &dsct->branches[idx].branch.attrs );
469
470 /* not last branch? */
471 if (idx + 1 != dsct->nr_branches) {
472 memmove( dsct->branches + idx, dsct->branches + idx + 1,
473 (dsct->nr_branches - idx - 1) * sizeof *dsct->branches);
474 /* update internal links */
475 for ( i=idx ; i<dsct->nr_branches-1 ; i++)
476 _post_copy_branch_update( dsct->branches+i );
477 }
478
479 dsct->nr_branches--;
480 /* cleanup the slot not used anymore */
481 memset( dsct->branches + dsct->nr_branches, 0, sizeof *dsct->branches );
482
483 return 0;
484}
485
486
487/*! \brief

Callers 3

w_remove_msg_branchFunction · 0.85
move_msg_branchFunction · 0.85
t_inject_branchFunction · 0.85

Calls 1

destroy_avp_listFunction · 0.85

Tested by

no test coverage detected