From 8db3859cc6f394927ca66bfc19c1227408fb7874 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 27 Aug 2019 11:12:34 -0400 Subject: Simple tests for nested configuration formats One test makes sure that the toplevel magic numbers are distinct. One test makes sure that we can parse a configuration object with two sub-objects. --- src/app/config/confparse.c | 4 ++-- src/app/config/confparse.h | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src/app') diff --git a/src/app/config/confparse.c b/src/app/config/confparse.c index 5c994c0a6a..71ba39ef52 100644 --- a/src/app/config/confparse.c +++ b/src/app/config/confparse.c @@ -234,7 +234,7 @@ config_mgr_get_suite_ptr(const config_mgr_t *mgr, void *toplevel) * to configuration objects for other modules. This function gets * the sub-object for a particular modules. */ -static void * +STATIC void * config_mgr_get_obj_mutable(const config_mgr_t *mgr, void *toplevel, int idx) { tor_assert(mgr); @@ -253,7 +253,7 @@ config_mgr_get_obj_mutable(const config_mgr_t *mgr, void *toplevel, int idx) } /** As config_mgr_get_obj_mutable(), but return a const pointer. */ -static const void * +STATIC const void * config_mgr_get_obj(const config_mgr_t *mgr, const void *toplevel, int idx) { return config_mgr_get_obj_mutable(mgr, (void*)toplevel, idx); diff --git a/src/app/config/confparse.h b/src/app/config/confparse.h index 74ecb11a36..b7923bb82b 100644 --- a/src/app/config/confparse.h +++ b/src/app/config/confparse.h @@ -146,6 +146,10 @@ bool config_var_is_contained(const config_var_t *var); #ifdef CONFPARSE_PRIVATE STATIC void config_reset_line(const config_mgr_t *mgr, void *options, const char *key, int use_defaults); +STATIC void *config_mgr_get_obj_mutable(const config_mgr_t *mgr, + void *toplevel, int idx); +STATIC const void *config_mgr_get_obj(const config_mgr_t *mgr, + const void *toplevel, int idx); #endif #endif /* !defined(TOR_CONFPARSE_H) */ -- cgit v1.2.3-54-g00ecf