]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
we only need INSERT as insert after
authorAlan T. DeKok <aland@freeradius.org>
Fri, 12 Nov 2021 16:26:58 +0000 (11:26 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 12 Nov 2021 16:26:58 +0000 (11:26 -0500)
src/lib/util/edit.c
src/lib/util/edit.h

index fc9d88f832f3eaff6c80f69bf8a8e6e8b17ace4a..879e3884caee0035b25f56a071bbf92dac52840b 100644 (file)
@@ -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:
index afb79c37447a3dbd42c31c97f83889f490ce2847..5e77f085553ee1c6f935a2d2b928b9f254a41fdc 100644 (file)
@@ -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;