From: Michael Tremer Date: Wed, 1 Feb 2023 22:03:29 +0000 (+0000) Subject: networkd: Change config read functions to not create a new instance X-Git-Url: http://git.ipfire.org/?p=network.git;a=commitdiff_plain;h=3239c3b1a98103e79ae7ab524fc12386a781249f networkd: Change config read functions to not create a new instance Signed-off-by: Michael Tremer --- diff --git a/src/networkd/config.c b/src/networkd/config.c index a11ee1cc..0048e44d 100644 --- a/src/networkd/config.c +++ b/src/networkd/config.c @@ -124,33 +124,13 @@ int nw_config_flush(struct nw_config* config) { return 0; } -static int nw_config_parse(struct nw_config* config, FILE* f) { +int nw_config_readf(struct nw_config* config, FILE* f) { // XXX TODO return 0; } -int nw_config_readf(struct nw_config** config, FILE* f) { - int r; - - // Create a new config object - r = nw_config_create(config); - if (r) - return r; - - // Parse the configuration - r = nw_config_parse(*config, f); - if (r) - goto ERROR; - - return 0; - -ERROR: - nw_config_free(*config); - return r; -} - -int nw_config_read(struct nw_config** config, const char* path) { +int nw_config_read(struct nw_config* config, const char* path) { FILE* f = NULL; int r; diff --git a/src/networkd/config.h b/src/networkd/config.h index 38780631..c4f91251 100644 --- a/src/networkd/config.h +++ b/src/networkd/config.h @@ -35,8 +35,8 @@ struct nw_config* nw_config_unref(struct nw_config* config); int nw_config_flush(struct nw_config* config); -int nw_config_readf(struct nw_config** config, FILE* f); -int nw_config_read(struct nw_config** config, const char* path); +int nw_config_readf(struct nw_config* config, FILE* f); +int nw_config_read(struct nw_config* config, const char* path); int nw_config_writef(struct nw_config* config, FILE* f); int nw_config_write(struct nw_config* config, const char* path);