From d484ba0ab0020866535a44be5948c9482b8f2b8d Mon Sep 17 00:00:00 2001 From: William Casarin Date: Mon, 2 Nov 2020 09:29:01 -0800 Subject: [PATCH] config/routing: fix maybe-uninitialized errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Trivial fix to silence compilation errors on gcc 9.3.0: src/config.c: In function ‘conf_ini_handler’: src/config.c:154:23: error: ‘routing’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 154 | enum gmnisrv_routing routing; | ^~~~~~~ src/config.c:197:18: error: ‘spec’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 197 | route->path = strdup(spec); | ^~~~~~~~~~~~ Signed-off-by: William Casarin --- src/config.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/config.c b/src/config.c index 662d02e..7c1b655 100644 --- a/src/config.c +++ b/src/config.c @@ -166,6 +166,8 @@ conf_ini_handler(void *user, const char *section, routing = ROUTE_REGEX; spec = §ion[hostln + 1]; break; + default: + assert(0); } assert(hostln < sizeof(hostname)); strncpy(hostname, section, hostln);