summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaushal M <kaushal@redhat.com>2012-12-03 12:12:57 +0530
committerAnand Avati <avati@redhat.com>2012-12-03 01:01:12 -0800
commit3cade0a1e9dfc641e5b6db2f044af9f50ff604d6 (patch)
tree83bcbe86136322fe45d499120afec0a9a8341117
parentf1ddc077a31671ff547efa205d86c1b8ebd3797a (diff)
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 <kaushal@redhat.com> Reviewed-on: http://review.gluster.org/4256 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
-rw-r--r--cli/src/cli-xml-output.c29
1 files changed, 29 insertions, 0 deletions
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)
+ * <Stuff using libxml>
+ * #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,