]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: pattern: rename pat_ref_commit() to pat_ref_commit_elt()
authorWilly Tarreau <w@1wt.eu>
Fri, 15 Jan 2021 13:11:59 +0000 (14:11 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 15 Jan 2021 13:11:59 +0000 (14:11 +0100)
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 :-/

include/haproxy/pattern.h
src/pattern.c

index cfaadcafed5ebd3464e64ac005009e89586b50d1..b8496da9d13678b037d507f7fe48b127697aabe9 100644 (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);
 
index 0b3bea27df9925523a9b159380cae3f6075d33b3..8729769e5e549bcd4043ae9220ceea440445332a 100644 (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");