]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add moc's xml patch
authorAnthony Minessale <anthony.minessale@gmail.com>
Thu, 11 Feb 2010 15:54:41 +0000 (15:54 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Thu, 11 Feb 2010 15:54:41 +0000 (15:54 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16604 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/include/switch_xml.h
src/switch_xml.c

index 3995532af353ceabe30777988c843971e5116ad2..e430952d4eb97f2e6d2eb83c130353e8e6e7e647 100644 (file)
@@ -96,6 +96,8 @@ struct switch_xml {
        switch_xml_t parent;
        /*! flags */
        uint32_t flags;
+       /*! is_switch_xml_root bool */
+       switch_bool_t is_switch_xml_root_t;
 };
 
 /*! 
index 6bff95982129d676a6dcbb2cab4a1365a23532d6..818c75a6a77c41fae874eb6cbea0e58fd8d6f3d5 100644 (file)
@@ -397,6 +397,12 @@ SWITCH_DECLARE(const char *) switch_xml_attr(switch_xml_t xml, const char *attr)
 
        while (root->xml.parent)
                root = (switch_xml_root_t) root->xml.parent;    /* root tag */
+
+       /* Make sure root is really a switch_xml_root_t (Issues with switch_xml_toxml) */
+       if (!root->xml.is_switch_xml_root_t) {
+               return NULL;
+       }
+
        for (i = 0; root->attr[i] && xml->name && strcmp(xml->name, root->attr[i][0]); i++);
        if (!root->attr[i])
                return NULL;                    /* no matching default attributes */
@@ -2343,6 +2349,7 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_new(const char *name)
        strcpy(root->err, root->xml.txt = (char *) "");
        root->ent = (char **) memcpy(malloc(sizeof(ent)), ent, sizeof(ent));
        root->attr = root->pi = (char ***) (root->xml.attr = SWITCH_XML_NIL);
+       root->xml.is_switch_xml_root_t = SWITCH_TRUE;
        return &root->xml;
 }