Revert "temporary changes for optimizations"
authorBen Pfaff <blp@cs.stanford.edu>
Sun, 9 Feb 2020 17:56:51 +0000 (17:56 +0000)
committerBen Pfaff <blp@cs.stanford.edu>
Sun, 9 Feb 2020 17:56:51 +0000 (17:56 +0000)
This reverts commit 5aaebfb786bc3dcecee1f8f9ae4e016bd28f72c6.

src/output/spv/spvxml-helpers.c
src/output/spv/spvxml-helpers.h
src/output/spv/xml-parser-generator

index d9d05e0d0a2de5957f68192994dac0b24c603b63..fb1420351d18bff4cb14ec9bf9eb23f9533e93ec 100644 (file)
@@ -29,7 +29,6 @@
 
 #include "gl/c-ctype.h"
 #include "gl/xvasprintf.h"
-#include "gl/xalloc.h"
 
 char * WARN_UNUSED_RESULT
 spvxml_context_finish (struct spvxml_context *ctx, struct spvxml_node *root)
@@ -333,16 +332,11 @@ find_attribute (struct spvxml_node_context *nctx, const char *name)
   for (struct spvxml_attribute *a = nctx->attrs;
        a < &nctx->attrs[nctx->n_attrs]; a++)
     {
-      if (!strcmp (a->name, name))
-        return a;
-
-      if (!a->multi)
-        continue;
-
       size_t a_len = strlen (a->name);
-      if ((a->name[a_len - 1] == '#'
-           && !strncmp (name, a->name, a_len - 1)
-           && all_digits (name + a_len - 1))
+      if (!strcmp (a->name, name)
+          || (a->name[a_len - 1] == '#'
+              && !strncmp (name, a->name, a_len - 1)
+              && all_digits (name + a_len - 1))
           || (a->name[a_len - 1] == '%'
               && !strncmp (name, a->name, a_len - 1)))
         return a;
@@ -787,8 +781,6 @@ spvxml_content_error (struct spvxml_node_context *nctx, const xmlNode *node,
   if (nctx->up->error)
     return;
 
-  nctx->up->error = xstrdup ("error");
-  return;
   struct string s = DS_EMPTY_INITIALIZER;
 
   ds_put_cstr (&s, "error parsing content of ");
index 6ffdf2a65bb0c280d5c6f50448f94165fda06673..16f73350131d10f090f736fd31424e77c3afc98c 100644 (file)
@@ -79,7 +79,6 @@ struct spvxml_attribute
   {
     const char *name;
     bool required;
-    bool multi;
     char *value;
   };
 
index ba6140de4218f509afe0f49080cf82bf23d83a3a..df34fbf8fffb41b8de9bbe1afa9c22a79d0ca505 100644 (file)
@@ -440,9 +440,8 @@ def print_attribute_decls(name, attributes):
     print('    struct spvxml_attribute attrs[] = {')
     for unique_name, (xml_name, value, required) in sorted(attributes.items()):
         c_name = name_to_id(unique_name)
-        print('        [ATTR_%s] = { "%s", %s, %s, NULL },'
-              % (c_name.upper(), xml_name, 'true' if required else 'false',
-                 'true' if '#' in xml_name or '%' in xml_name else 'false'))
+        print('        [ATTR_%s] = { "%s", %s, NULL },'
+              % (c_name.upper(), xml_name, 'true' if required else 'false'))
     print('    };')
     print('    enum { N_ATTRS = sizeof attrs / sizeof *attrs };')