CLEANUP: pattern: rename pat_ref_commit() to pat_ref_commit_elt()

It's about the third time I get confused by these functions, half of
which manipulate the reference as a whole and those manipulating only
an entry. For me "pat_ref_commit" means committing the pattern reference,
not just an element, so let's rename it. A number of other ones should
really be renamed before 2.4 gets released :-/
This commit is contained in:
Willy Tarreau 2021-01-15 14:11:59 +01:00
parent 6a9060189d
commit dc2410d093
2 changed files with 3 additions and 3 deletions

View File

@ -191,7 +191,7 @@ int pat_ref_delete(struct pat_ref *ref, const char *key);
void pat_ref_delete_by_ptr(struct pat_ref *ref, struct pat_ref_elt *elt);
int pat_ref_delete_by_id(struct pat_ref *ref, struct pat_ref_elt *refelt);
int pat_ref_prune(struct pat_ref *ref);
int pat_ref_commit(struct pat_ref *ref, struct pat_ref_elt *elt, char **err);
int pat_ref_commit_elt(struct pat_ref *ref, struct pat_ref_elt *elt, char **err);
int pat_ref_purge_older(struct pat_ref *ref, unsigned int oldest, int budget);
void pat_ref_reload(struct pat_ref *ref, struct pat_ref *replace);

View File

@ -1965,7 +1965,7 @@ int pat_ref_push(struct pat_ref_elt *elt, struct pattern_expr *expr,
* pointer <err> may have been updated (and the caller must free it). Failure
* causes include memory allocation, parsing error or indexing error.
*/
int pat_ref_commit(struct pat_ref *ref, struct pat_ref_elt *elt, char **err)
int pat_ref_commit_elt(struct pat_ref *ref, struct pat_ref_elt *elt, char **err)
{
struct pattern_expr *expr;
@ -1996,7 +1996,7 @@ struct pat_ref_elt *pat_ref_load(struct pat_ref *ref, unsigned int gen,
elt = pat_ref_append(ref, pattern, sample, line);
if (elt) {
elt->gen_id = gen;
if (!pat_ref_commit(ref, elt, err))
if (!pat_ref_commit_elt(ref, elt, err))
elt = NULL;
} else
memprintf(err, "out of memory error");