Skip to content

Commit 5b727c0

Browse files
authored
Merge pull request #229 from igaw/remove-jsonc-ifdefs
tree: Remove CONFIG_JSONC ifdefs
2 parents 1f77d50 + 312ca03 commit 5b727c0

1 file changed

Lines changed: 16 additions & 29 deletions

File tree

src/nvme/tree.c

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -140,21 +140,22 @@ nvme_root_t nvme_create_root(FILE *fp, int log_level)
140140
int nvme_read_config(nvme_root_t r, const char *config_file)
141141
{
142142
int err = -1;
143-
#ifdef CONFIG_JSONC
144-
if (r && config_file) {
145-
err = json_read_config(r, config_file);
146-
if (!err)
147-
r->config_file = strdup(config_file);
148-
/*
149-
* The json configuration file is optional,
150-
* so ignore errors when opening the file.
151-
*/
152-
if (err < 0 && errno != EPROTO)
153-
err = 0;
143+
144+
if (!r || !config_file) {
145+
errno = ENODEV;
146+
return err;
154147
}
155-
#else
156-
errno = ENOTSUP;
157-
#endif
148+
149+
err = json_read_config(r, config_file);
150+
if (!err)
151+
r->config_file = strdup(config_file);
152+
/*
153+
* The json configuration file is optional,
154+
* so ignore errors when opening the file.
155+
*/
156+
if (err < 0 && errno != EPROTO)
157+
err = 0;
158+
158159
return err;
159160
}
160161

@@ -171,32 +172,18 @@ int nvme_update_config(nvme_root_t r)
171172
{
172173
if (!r->modified || !r->config_file)
173174
return 0;
174-
#ifdef CONFIG_JSONC
175+
175176
return json_update_config(r, r->config_file);
176-
#else
177-
errno = ENOTSUP;
178-
return -1;
179-
#endif
180177
}
181178

182179
int nvme_dump_config(nvme_root_t r)
183180
{
184-
#ifdef CONFIG_JSONC
185181
return json_update_config(r, NULL);
186-
#else
187-
errno = ENOTSUP;
188-
return -1;
189-
#endif
190182
}
191183

192184
int nvme_dump_tree(nvme_root_t r)
193185
{
194-
#ifdef CONFIG_JSONC
195186
return json_dump_tree(r);
196-
#else
197-
errno = ENOTSUP;
198-
return -1;
199-
#endif
200187
}
201188

202189
nvme_host_t nvme_first_host(nvme_root_t r)

0 commit comments

Comments
 (0)