[macruby-changes] [4375] MacRuby/trunk/bs.c

source_changes at macosforge.org source_changes at macosforge.org
Fri Jul 23 20:06:27 PDT 2010


Revision: 4375
          http://trac.macosforge.org/projects/ruby/changeset/4375
Author:   lsansonetti at apple.com
Date:     2010-07-23 20:06:27 -0700 (Fri, 23 Jul 2010)
Log Message:
-----------
don't abort when handling string constants with an empty value (fixes <rdar://problem/8230638>)

Modified Paths:
--------------
    MacRuby/trunk/bs.c

Modified: MacRuby/trunk/bs.c
===================================================================
--- MacRuby/trunk/bs.c	2010-07-24 02:16:49 UTC (rev 4374)
+++ MacRuby/trunk/bs.c	2010-07-24 03:06:27 UTC (rev 4375)
@@ -481,12 +481,18 @@
   }                                             \
   while (0)
 
-#define CHECK_ATTRIBUTE(a, name)                        \
+#define CHECK_ATTRIBUTE_CAN_BE_EMPTY(a, name) \
+  CHECK_ATTRIBUTE0(a, name, true)
+
+#define CHECK_ATTRIBUTE(a, name) \
+  CHECK_ATTRIBUTE0(a, name, false)
+
+#define CHECK_ATTRIBUTE0(a, name, can_be_empty)         \
   do {                                                  \
     if (a == NULL)                                      \
       BAIL("expected attribute `%s' for element `%s'",  \
            name, xmlTextReaderConstName(reader));       \
-    if (*a == '\0') {                                   \
+    if (!can_be_empty && *a == '\0') {                  \
       free(a);                                          \
       BAIL("empty attribute `%s' for element `%s'",     \
            name, xmlTextReaderConstName(reader));       \
@@ -600,7 +606,7 @@
           strconst_name = get_attribute(reader, "name");
           CHECK_ATTRIBUTE(strconst_name, "name");
           strconst_value = get_attribute(reader, "value");
-          CHECK_ATTRIBUTE(strconst_value, "value");
+          CHECK_ATTRIBUTE_CAN_BE_EMPTY(strconst_value, "value");
 
           bs_strconst = (bs_element_string_constant_t *)
             malloc(sizeof(bs_element_string_constant_t));
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100723/92056ed6/attachment.html>


More information about the macruby-changes mailing list