From d8cb7dc2ce4104751c5062f58221bc2b84b7f7fd Mon Sep 17 00:00:00 2001 From: "Alan T. DeKok" Date: Fri, 12 Nov 2021 16:21:45 -0500 Subject: [PATCH] minor notes --- src/lib/util/edit.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/lib/util/edit.c b/src/lib/util/edit.c index 7a89917130..26333a36cc 100644 --- a/src/lib/util/edit.c +++ b/src/lib/util/edit.c @@ -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; /* -- 2.47.2