]> git.ipfire.org Git - network.git/commitdiff
networkd: Change config read functions to not create a new instance
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 1 Feb 2023 22:03:29 +0000 (22:03 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 1 Feb 2023 22:03:29 +0000 (22:03 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/networkd/config.c
src/networkd/config.h

index a11ee1cc583a84ac20bbf76c883edf687dd2a80d..0048e44dd7107f960b4c5e35cc4513a7ef3787f6 100644 (file)
@@ -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;
 
index 38780631d5b579299b8771e672a3a753e37f1544..c4f91251bbd4b790e877104ae00215e4211451ac 100644 (file)
@@ -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);