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>
This commit is contained in:
Kaushal M 2012-12-03 12:12:57 +05:30 committed by Anand Avati
parent f1ddc077a3
commit 3cade0a1e9

View File

@ -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,