Commit 6b141c54 authored by Andre Pang's avatar Andre Pang

* Fix CMML codec on systems where strcmp(1) dies if you give it a NULL pointer (such as Windows)

parent 79053042
...@@ -381,7 +381,7 @@ xtag_parse_tag (XTagParser * parser) ...@@ -381,7 +381,7 @@ xtag_parse_tag (XTagParser * parser)
xtag_assert_and_pass (parser, X_SLASH); xtag_assert_and_pass (parser, X_SLASH);
name = xtag_slurp_to (parser, X_WHITESPACE | X_CLOSETAG, X_NONE); name = xtag_slurp_to (parser, X_WHITESPACE | X_CLOSETAG, X_NONE);
if (name) { if (name) {
if (strcmp (name, tag->name)) { if (name && tag->name && strcmp (name, tag->name)) {
#ifdef XTAG_DEBUG #ifdef XTAG_DEBUG
printf ("got %s expected %s\n", name, tag->name); printf ("got %s expected %s\n", name, tag->name);
#endif #endif
...@@ -525,7 +525,7 @@ xtag_get_attribute (XTag * xtag, char * attribute) ...@@ -525,7 +525,7 @@ xtag_get_attribute (XTag * xtag, char * attribute)
for (l = xtag->attributes; l; l = l->next) { for (l = xtag->attributes; l; l = l->next) {
if ((attr = (XAttribute *)l->data) != NULL) { if ((attr = (XAttribute *)l->data) != NULL) {
if (!strcmp (attr->name, attribute)) if (attr->name && attribute && !strcmp (attr->name, attribute))
return attr->value; return attr->value;
} }
} }
...@@ -551,7 +551,7 @@ xtag_first_child (XTag * xtag, char * name) ...@@ -551,7 +551,7 @@ xtag_first_child (XTag * xtag, char * name)
for (; l; l = l->next) { for (; l; l = l->next) {
child = (XTag *)l->data; child = (XTag *)l->data;
if (!strcmp(child->name, name)) { if (child->name && name && !strcmp(child->name, name)) {
xtag->current_child = l; xtag->current_child = l;
return child; return child;
} }
...@@ -584,7 +584,7 @@ xtag_next_child (XTag * xtag, char * name) ...@@ -584,7 +584,7 @@ xtag_next_child (XTag * xtag, char * name)
for (; l; l = l->next) { for (; l; l = l->next) {
child = (XTag *)l->data; child = (XTag *)l->data;
if (!strcmp(child->name, name)) { if (child->name && name && !strcmp(child->name, name)) {
xtag->current_child = l; xtag->current_child = l;
return child; return child;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment