[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH V3 03/13] libxl.h: move / add some libxl defbool #define here
They will be used by both JSON generator and parser so they should be in header file. Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- tools/libxl/libxl.c | 10 +++------- tools/libxl/libxl.h | 6 ++++++ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 30b0b06..34de26b 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -232,10 +232,6 @@ void libxl_key_value_list_dispose(libxl_key_value_list *pkvl) free(kvl); } -#define LIBXL__DEFBOOL_DEFAULT (0) -#define LIBXL__DEFBOOL_FALSE (-1) -#define LIBXL__DEFBOOL_TRUE (1) - void libxl_defbool_set(libxl_defbool *db, bool b) { db->val = b ? LIBXL__DEFBOOL_TRUE : LIBXL__DEFBOOL_FALSE; @@ -266,11 +262,11 @@ bool libxl_defbool_val(libxl_defbool db) const char *libxl_defbool_to_string(libxl_defbool b) { if (b.val < 0) - return "False"; + return LIBXL__DEFBOOL_STR_FALSE; else if (b.val > 0) - return "True"; + return LIBXL__DEFBOOL_STR_TRUE; else - return "<default>"; + return LIBXL__DEFBOOL_STR_DEFAULT; } /******************************************************************************/ diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h index 47ddd65..7bface3 100644 --- a/tools/libxl/libxl.h +++ b/tools/libxl/libxl.h @@ -526,6 +526,12 @@ typedef LIBXL_TAILQ_ENTRY(struct libxl_event) libxl_ev_link; * To allow users of the library to naively select all defaults this * state is represented as 0. False is < 0 and True is > 0. */ +#define LIBXL__DEFBOOL_DEFAULT (0) +#define LIBXL__DEFBOOL_FALSE (-1) +#define LIBXL__DEFBOOL_TRUE (1) +#define LIBXL__DEFBOOL_STR_DEFAULT "<default>" +#define LIBXL__DEFBOOL_STR_FALSE "False" +#define LIBXL__DEFBOOL_STR_TRUE "True" typedef struct { int val; } libxl_defbool; -- 1.7.10.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |