[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 15/22] tools/utils: move XLU_Config to libxlu_cfg.c



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@xxxxxxx>
---
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(-)

diff --git a/tools/libs/util/libxlu_cfg.c b/tools/libs/util/libxlu_cfg.c
index e37f84829f..69b95a4ed0 100644
--- a/tools/libs/util/libxlu_cfg.c
+++ b/tools/libs/util/libxlu_cfg.c
@@ -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);
 }
 
diff --git a/tools/libs/util/libxlu_internal.h 
b/tools/libs/util/libxlu_internal.h
index 214ebe5f48..93caf24a6e 100644
--- a/tools/libs/util/libxlu_internal.h
+++ b/tools/libs/util/libxlu_internal.h
@@ -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)
-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |       ehem+sigmsg@xxxxxxx      PGP 87145445       |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445






 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.