From: Willy Tarreau Date: Wed, 30 Mar 2022 09:49:59 +0000 (+0200) Subject: MINOR: acl: alphanumerically sort the ACL dump X-Git-Tag: v2.6-dev5~103 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=800bd789447263187bda2271d7be58c4ef7c7540;p=thirdparty%2Fhaproxy.git MINOR: acl: alphanumerically sort the ACL dump The mechanism is similar to others. We take care of sorting on the keyword only and not the fetch_kw which is not unique. --- diff --git a/src/acl.c b/src/acl.c index 77d67172fe..15ca7668e2 100644 --- a/src/acl.c +++ b/src/acl.c @@ -1312,17 +1312,28 @@ int init_acl() void acl_dump_kwd(void) { struct acl_kw_list *kwl; + const struct acl_keyword *kwp, *kw; const char *name; int index; - list_for_each_entry(kwl, &acl_keywords.list, list) { - for (index = 0; kwl->kw[index].kw != NULL; index++) { - name = kwl->kw[index].fetch_kw; - if (!name) - name = kwl->kw[index].kw; - - printf("%s = %s -m %s\n", kwl->kw[index].kw, name, pat_match_names[kwl->kw[index].match_type]); + for (kw = kwp = NULL;; kwp = kw) { + list_for_each_entry(kwl, &acl_keywords.list, list) { + for (index = 0; kwl->kw[index].kw != NULL; index++) { + if (strordered(kwp ? kwp->kw : NULL, + kwl->kw[index].kw, + kw != kwp ? kw->kw : NULL)) + kw = &kwl->kw[index]; + } } + + if (kw == kwp) + break; + + name = kw->fetch_kw; + if (!name) + name = kw->kw; + + printf("%s = %s -m %s\n", kw->kw, name, pat_match_names[kw->match_type]); } }