aboutsummaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-07-23 09:17:51 -0400
committerNick Mathewson <nickm@torproject.org>2019-07-24 15:21:56 -0400
commita1b2817abefc5c696e469fa4fd8a09cc5f286aa6 (patch)
tree5b5e59cdcd2214e123169ae4f9508f109806f1e2 /src/app
parentdde091ebc76d8ae5d93c1b3e1febfa2c9d1459fa (diff)
downloadtor-a1b2817abefc5c696e469fa4fd8a09cc5f286aa6.tar.gz
tor-a1b2817abefc5c696e469fa4fd8a09cc5f286aa6.zip
Sort variables in config_mgr_t.all_vars alphabetically
Diffstat (limited to 'src/app')
-rw-r--r--src/app/config/confparse.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/app/config/confparse.c b/src/app/config/confparse.c
index b086f8c94a..c7ee8f3010 100644
--- a/src/app/config/confparse.c
+++ b/src/app/config/confparse.c
@@ -169,6 +169,16 @@ config_mgr_get_obj(const config_mgr_t *mgr, const void *toplevel, int idx)
return config_mgr_get_obj_mutable(mgr, (void*)toplevel, idx);
}
+/** Sorting helper for smartlist of managed_var_t */
+static int
+managed_var_cmp(const void **a, const void **b)
+{
+ const managed_var_t *mv1 = *(const managed_var_t**)a;
+ const managed_var_t *mv2 = *(const managed_var_t**)b;
+
+ return strcasecmp(mv1->cvar->member.name, mv2->cvar->member.name);
+}
+
/**
* Mark a configuration manager as "frozen", so that no more formats can be
* added, and so that it can be used for manipulating configuration objects.
@@ -176,6 +186,7 @@ config_mgr_get_obj(const config_mgr_t *mgr, const void *toplevel, int idx)
void
config_mgr_freeze(config_mgr_t *mgr)
{
+ smartlist_sort(mgr->all_vars, managed_var_cmp);
mgr->frozen = true;
}