From 3cade0a1e9dfc641e5b6db2f044af9f50ff604d6 Mon Sep 17 00:00:00 2001 From: Kaushal M Date: Mon, 3 Dec 2012 12:12:57 +0530 Subject: cli: Fix build when libxml2 is absent Also added a note to the top of cli-xml-output.c, explaining the style of coding to followed when adding code to it. Change-Id: I7f90a9c075adb49a9e071771d136b6f01ea68d11 BUG: 882780 Signed-off-by: Kaushal M Reviewed-on: http://review.gluster.org/4256 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- cli/src/cli-xml-output.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/cli/src/cli-xml-output.c b/cli/src/cli-xml-output.c index 3e8bbdd4fbf..938f8dce18a 100644 --- a/cli/src/cli-xml-output.c +++ b/cli/src/cli-xml-output.c @@ -14,6 +14,33 @@ #include "compat.h" #include "syscall.h" +/* + * IMPORTANT NOTE: + * All exported functions in this file which use libxml need use a + * #if (HAVE_LIB_XML), #else, #endif + * For eg, + * int exported_func () { + * #if (HAVE_LIB_XML) + * + * #else + * return 0; + * #endif + * } + * + * All other functions, which are called internally within this file need to be + * within #if (HAVE_LIB_XML), #endif statements + * For eg, + * #if (HAVE_LIB_XML) + * int internal_func () + * { + * } + * #endif + * + * Following the above formate ensures that all xml related code is compliled + * only when libxml2 is present, and also keeps the rest of the codebase free + * of #if (HAVE_LIB_XML) + */ + #if (HAVE_LIB_XML) @@ -3169,6 +3196,7 @@ out: #endif } +#if (HAVE_LIB_XML) int cli_xml_output_vol_gsync_status (dict_t *dict, xmlTextWriterPtr writer) { @@ -3244,6 +3272,7 @@ out: gf_log ("cli",GF_LOG_DEBUG, "Returning %d", ret); return ret; } +#endif int cli_xml_output_vol_gsync (dict_t *dict, int op_ret, int op_errno, -- cgit