]> xenbits.xensource.com Git - people/andrewcoop/hwloc.git/commitdiff
nolibxml: add support for child tag without att...
authorBrice Goglin <brice.goglin@inria.fr>
Tue, 10 Sep 2013 19:47:49 +0000 (19:47 +0000)
committerBrice Goglin <brice.goglin@inria.fr>
Tue, 10 Sep 2013 19:47:49 +0000 (19:47 +0000)
nolibxml: add support for child tag without attributes

(wasn't needed so far, since the <topology> root tag is handled manually)

This commit was SVN r5795.

src/topology-xml-nolibxml.c

index 0f38794692ae6983c8db84ec337626afc174e5de..d9a1cdfd9ccecc68a136e69e16e8c7d2313ffba8 100644 (file)
@@ -50,6 +50,9 @@ hwloc__nolibxml_import_next_attr(hwloc__xml_import_state_t state, char **namep,
   size_t len, escaped;
   char *buffer, *value, *end;
 
+  if (!nstate->attrbuffer)
+    return -1;
+
   /* find the beginning of an attribute */
   buffer = hwloc__nolibxml_import_ignore_spaces(nstate->attrbuffer);
   namelen = strspn(buffer, "abcdefghijklmnopqrstuvwxyz_");
@@ -154,8 +157,12 @@ hwloc__nolibxml_import_find_child(hwloc__xml_import_state_t state,
 
   /* find attributes */
   namelen = strspn(buffer, "abcdefghijklmnopqrstuvwxyz_");
-  /* cannot be without attributes */
-  assert(buffer[namelen] != '\0');
+
+  if (buffer[namelen] == '\0') {
+    /* no attributes */
+    nchildstate->attrbuffer = NULL;
+    return 1;
+  }
 
   if (buffer[namelen] != ' ')
     return -1;