From: Alan T. DeKok Date: Fri, 12 Nov 2021 21:21:45 +0000 (-0500) Subject: minor notes X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d8cb7dc2ce4104751c5062f58221bc2b84b7f7fd;p=thirdparty%2Ffreeradius-server.git minor notes --- diff --git a/src/lib/util/edit.c b/src/lib/util/edit.c index 7a89917130f..26333a36ccc 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; /*