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

[PATCH 09/22] tools/utils: move CfgParseContext to top of libxlu_cfg_y.y



The CfgParseContext structure/typedef is used inside the parser.  Whereas
most #include's of libxlu_internal.h need the common declarations, not
the parser internals.  Due to this, the structure should be near the top
of libxlu_cfg_y.h (libxlu_cfg_i.h @b104c3762d), and not towards the
middle of libxlu_internal.h.

Fixes: b104c3762d ('Replace config file parser for "xl"')
Signed-off-by: Elliott Mitchell <ehem+xen@xxxxxxx>
---
Ideally at @b104c3762d Bison might already have implemented its %code
feature.  Less ideal, but workable CfgParseContext should have been
placed in libxlu_cfg_i.h, between the two #includes:
 #include "libxlu_internal.h"
 typedef struct { } CfgParseContext;
 #include "libxlu_cfg_y.h"

Using Bison's %code feature is rather superior though.  This patch is
where indentation in Bison.y files becomes crucial.  I'm unsure of the
call to make, so I've left this as cut&paste which means this will almost
certainly change.
---
 tools/libs/util/libxlu_cfg_y.y    | 6 ++++++
 tools/libs/util/libxlu_internal.h | 6 ------
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/libs/util/libxlu_cfg_y.y b/tools/libs/util/libxlu_cfg_y.y
index adbb74ff11..75e7140478 100644
--- a/tools/libs/util/libxlu_cfg_y.y
+++ b/tools/libs/util/libxlu_cfg_y.y
@@ -18,6 +18,12 @@
 
 %code requires {
 #include "libxlu_internal.h"
+
+typedef struct {
+    XLU_Config *cfg;
+    int err, lexerrlineno, likely_python;
+    void *scanner;
+} CfgParseContext;
 }
 
 %code provides {
diff --git a/tools/libs/util/libxlu_internal.h 
b/tools/libs/util/libxlu_internal.h
index 01fe073069..246ad0bde7 100644
--- a/tools/libs/util/libxlu_internal.h
+++ b/tools/libs/util/libxlu_internal.h
@@ -63,12 +63,6 @@ struct XLU_Config {
     char *config_source;
 };
 
-typedef struct {
-    XLU_Config *cfg;
-    int err, lexerrlineno, likely_python;
-    void *scanner;
-} CfgParseContext;
-
 
 #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®.