@@ -47,6 +47,12 @@ struct XLU_ConfigValue {
XLU__CFG_YYLTYPE loc;
};
+struct XLU_Config {
+ XLU_ConfigSetting *settings;
+ FILE *report;
+ const char *config_source;
+};
+
XLU_Config *xlu_cfg_init(FILE *report, const char *report_source) {
XLU_Config *cfg;
@@ -188,7 +194,7 @@ void xlu_cfg_destroy(XLU_Config *cfg) {
set_next= set->next;
xlu__cfg_set_free(set);
}
- free(cfg->config_source);
+ free((void *)cfg->config_source);
free(cfg);
}
@@ -27,12 +27,6 @@
typedef struct XLU_ConfigSetting XLU_ConfigSetting;
-struct XLU_Config {
- XLU_ConfigSetting *settings;
- FILE *report;
- char *config_source;
-};
-
#define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x)
Only the lowest layer of configuration handling looks inside XLU_Config. As such the structure can move to this header instead of the shared header. Mark ->config_source as constant. Most places it truly is constant, only the free() violates the constant. Signed-off-by: Elliott Mitchell <ehem+xen@m5p.com> --- This could also move to libxlu_cfg_y.h and make preserving messages easier while allowing libxlu_cfg.c to split. --- tools/libs/util/libxlu_cfg.c | 8 +++++++- tools/libs/util/libxlu_internal.h | 6 ------ 2 files changed, 7 insertions(+), 7 deletions(-)