]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
minor notes
authorAlan T. DeKok <aland@freeradius.org>
Fri, 12 Nov 2021 21:21:45 +0000 (16:21 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 12 Nov 2021 21:24:50 +0000 (16:24 -0500)
src/lib/util/edit.c

index 7a89917130f0f4b657b8b1d438985e09d4dce29d..26333a36ccc489142e2c1edc5226eebd572fc8ae 100644 (file)
@@ -35,6 +35,18 @@ typedef enum {
        FR_EDIT_INSERT,                 //!< insert a VP into a list, after another one.
 } fr_edit_op_t;
 
+#if 0
+/*
+ *     For debugging.
+ */
+static const char *edit_names[4] = {
+       "invalid",
+       "delete",
+       "record_value",
+       "insert",
+};
+#endif
+
 /** Track a series of edits.
  *
  */
@@ -81,6 +93,9 @@ static int edit_undo(fr_edit_t *e)
        int rcode;
 #endif
 
+       fr_assert(vp != NULL);
+       PAIR_VERIFY(vp);
+
        switch (e->op) {
        case FR_EDIT_INVALID:
                return -1;
@@ -397,6 +412,12 @@ int fr_edit_list_replace(fr_edit_list_t *el, fr_pair_list_t *list, fr_pair_t *to
 
        if (to_replace->da != vp->da) return -1;
 
+       /*
+        *      We call edit_record() twice, which involves two
+        *      complete passes over the edit list.  That's fine,
+        *      either the edit list is small, OR we will eventially
+        *      put the VPs to be edited into an RB tree.
+        */
        if (edit_record(el, FR_EDIT_INSERT, vp, list, to_replace) < 0) return -1;
 
        /*