Add FullConfig destructor
This commit is contained in:
parent
245563ec8b
commit
5875575d0b
18
config.c
18
config.c
|
@ -135,3 +135,21 @@ load_config(const config_setting_t *config_root, FullConfig *config)
|
|||
config->channels = load_channels_section(channel_config);
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
reset_config(FullConfig *config)
|
||||
{
|
||||
if (!config) {
|
||||
return;
|
||||
}
|
||||
if (config->nodes.items) {
|
||||
free(config->nodes.items);
|
||||
config->nodes.items = NULL;
|
||||
config->nodes.length = 0;
|
||||
}
|
||||
if (config->channels.items) {
|
||||
free(config->channels.items);
|
||||
config->channels.items = NULL;
|
||||
config->channels.length = 0;
|
||||
}
|
||||
}
|
||||
|
|
1
config.h
1
config.h
|
@ -33,5 +33,6 @@ typedef struct {
|
|||
} FullConfig;
|
||||
|
||||
bool load_config(const config_setting_t *config_root, FullConfig *config);
|
||||
void reset_config(FullConfig *config);
|
||||
|
||||
#endif /* end of include guard: CONFIG_H_ */
|
||||
|
|
Loading…
Reference in New Issue