Revision: 4375 http://trac.macosforge.org/projects/ruby/changeset/4375 Author: lsansonetti@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));
participants (1)
-
source_changes@macosforge.org