Permalink
Browse files

work around missing xmlFirstElementChild() in older libxml2 (CentOS/R…

…HEL 5)
  • Loading branch information...
1 parent 38f41a4 commit c7a114f937de0485720180bb2cf1ffe476bd2769 @juphoff juphoff committed Aug 23, 2012
Showing with 6,131 additions and 2,478 deletions.
  1. +6,103 −2,477 configure
  2. +1 −1 configure.ac
  3. +3 −0 util/eucalyptus-config.h.in
  4. +24 −0 util/fault.c
View
8,580 configure
6,103 additions, 2,477 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
2 configure.ac
@@ -272,7 +272,7 @@ AC_FUNC_SELECT_ARGTYPES
AC_FUNC_STAT
AC_FUNC_STRNLEN
AC_FUNC_VPRINTF
-AC_CHECK_FUNCS([bzero dup2 ftruncate gettimeofday mkdir pow select strchr strdup strerror strncasecmp strstr rmdir])
+AC_CHECK_FUNCS([bzero dup2 ftruncate gettimeofday mkdir pow select strchr strdup strerror strncasecmp strstr rmdir xmlFirstElementChild])
# Time to substitute and generate the files
AC_CONFIG_FILES([Makedefs
View
3 util/eucalyptus-config.h.in
@@ -131,6 +131,9 @@
/* Define if we have libcap */
#undef HAVE_LIBCAP
+/* Define if we have xmlFirstElementChild */
+#undef HAVE_XMLFIRSTELEMENTCHILD
+
#ifdef __cplusplus
}
#endif
View
24 util/fault.c
@@ -41,6 +41,7 @@
#include <libxml/parser.h>
#include <libxml/tree.h>
+#include <eucalyptus-config.h>
#include <eucalyptus.h>
#include <misc.h>
#include <fault.h>
@@ -137,6 +138,10 @@ static char *get_fault_var (const char *, const xmlNode *);
static boolean format_eucafault (const char *, const char_map **);
static boolean initialize_faultlog (const char *);
+#ifndef HAVE_XMLFIRSTELEMENTCHILD
+static xmlNodePtr xmlFirstElementChild (xmlNodePtr);
+#endif // HAVE_XMLFIRSTELEMENTCHILD
+
/*
* Utility functions -- move to misc.c?
* (Might some of them already be there in one form or another?)
@@ -191,6 +196,25 @@ scandir_filter (const struct dirent *entry)
return str_end_cmp (entry->d_name, XML_SUFFIX);
}
+#ifndef HAVE_XMLFIRSTELEMENTCHILD
+/*
+ * Utility function:
+ *
+ * Needed for older versions of libxml2 (e.g. on RHEL/CentOS 5), which
+ * don't contain this function.
+ */
+static xmlNodePtr xmlFirstElementChild (xmlNodePtr parent)
+{
+ xmlNodePtr child;
+ for (child = parent->children; child != NULL; child = child->next) {
+ if (child->type == XML_ELEMENT_NODE) {
+ break;
+ }
+ }
+ return child;
+}
+#endif // HAVE_XMLFIRSTELEMENTCHILD
+
/*
* End utility functions.
*/

0 comments on commit c7a114f

Please sign in to comment.