From: Sebastian Harl Date: Mon, 21 Apr 2014 17:38:38 +0000 (+0200) Subject: sysdbd: Added daemon_free_listen_addresses(). X-Git-Tag: sysdb-0.1.0~107 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=e8efc2693381b9db9cd33ad32a3ca7bfad74b84f;p=sysdb.git sysdbd: Added daemon_free_listen_addresses(). This is a helper function for handling config settings. --- diff --git a/src/tools/sysdbd/configfile.c b/src/tools/sysdbd/configfile.c index 9e918d5..5a36c22 100644 --- a/src/tools/sysdbd/configfile.c +++ b/src/tools/sysdbd/configfile.c @@ -250,6 +250,22 @@ static token_parser_t token_parser_list[] = { * public API */ +void +daemon_free_listen_addresses(void) +{ + size_t i; + + if (! listen_addresses) + return; + + for (i = 0; i < listen_addresses_num; ++i) + free(listen_addresses[i]); + free(listen_addresses); + + listen_addresses = NULL; + listen_addresses_num = 0; +} /* daemon_free_listen_addresses */ + int daemon_parse_config(const char *filename) { diff --git a/src/tools/sysdbd/configfile.h b/src/tools/sysdbd/configfile.h index 19abe9a..2d8945c 100644 --- a/src/tools/sysdbd/configfile.h +++ b/src/tools/sysdbd/configfile.h @@ -37,6 +37,9 @@ extern char **listen_addresses; extern size_t listen_addresses_num; +void +daemon_free_listen_addresses(void); + /* * daemon_parse_config: * Parse the specified configuration file.