From: Alan T. DeKok Date: Fri, 12 Nov 2021 16:26:58 +0000 (-0500) Subject: we only need INSERT as insert after X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6011874de77a82635f2fa3e943e50f7d5f1b637b;p=thirdparty%2Ffreeradius-server.git we only need INSERT as insert after --- diff --git a/src/lib/util/edit.c b/src/lib/util/edit.c index fc9d88f832..879e3884ca 100644 --- a/src/lib/util/edit.c +++ b/src/lib/util/edit.c @@ -98,8 +98,7 @@ static int edit_undo(fr_edit_t *e) fr_assert(rcode == 0); break; - case FR_EDIT_INSERT_BEFORE: - case FR_EDIT_INSERT_AFTER: + case FR_EDIT_INSERT: /* * We can free the VP here, as any edits to its' * children MUST come after the creation of the @@ -220,8 +219,7 @@ int fr_edit_list_record(fr_edit_list_t *el, fr_edit_op_t op, fr_pair_t *vp, fr_p * pair (inserted, deleted, or updated * the value), as the pair is new! */ - case FR_EDIT_INSERT_BEFORE: - case FR_EDIT_INSERT_AFTER: + case FR_EDIT_INSERT: fr_assert(0); return -1; @@ -249,8 +247,7 @@ int fr_edit_list_record(fr_edit_list_t *el, fr_edit_op_t op, fr_pair_t *vp, fr_p * edit list is freed, the VP will be * freed. */ - if ((e->op == FR_EDIT_INSERT_BEFORE) || - (e->op == FR_EDIT_INSERT_AFTER)) { + if (e->op == FR_EDIT_INSERT) { fr_assert(e->list == list); fr_pair_remove(list, vp); @@ -308,18 +305,7 @@ int fr_edit_list_record(fr_edit_list_t *el, fr_edit_op_t op, fr_pair_t *vp, fr_p } break; - case FR_EDIT_INSERT_BEFORE: - fr_assert(list != NULL); - - /* - * There's no need to record "prev". On undo, we - * just delete this pair from the list. - */ - e->list = list; - fr_pair_insert_before(list, ref, vp); - break; - - case FR_EDIT_INSERT_AFTER: + case FR_EDIT_INSERT: fr_assert(list != NULL); /* @@ -365,8 +351,7 @@ static int _edit_list_destructor(fr_edit_list_t *el) fr_assert(0); break; - case FR_EDIT_INSERT_BEFORE: - case FR_EDIT_INSERT_AFTER: + case FR_EDIT_INSERT: break; case FR_EDIT_DELETE: diff --git a/src/lib/util/edit.h b/src/lib/util/edit.h index afb79c3744..5e77f08555 100644 --- a/src/lib/util/edit.h +++ b/src/lib/util/edit.h @@ -35,8 +35,7 @@ typedef enum { FR_EDIT_INVALID = 0, FR_EDIT_DELETE, //!< delete a VP FR_EDIT_VALUE, //!< edit a VP in place - FR_EDIT_INSERT_BEFORE, //!< insert a VP into a list, before another one - FR_EDIT_INSERT_AFTER, //!< insert a VP into a list, after another one. + FR_EDIT_INSERT, //!< insert a VP into a list, after another one. } fr_edit_op_t; typedef struct fr_edit_list_s fr_edit_list_t;