Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: third_party/libxml/src/tree.c

Issue 1977213002: Roll libxml to 8effcb578e0590cc01bbcab0f9dccefc6bdbcdbd (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update README.chromium. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * tree.c : implementation of access function for an XML tree. 2 * tree.c : implementation of access function for an XML tree.
3 * 3 *
4 * References: 4 * References:
5 * XHTML 1.0 W3C REC: http://www.w3.org/TR/2002/REC-xhtml1-20020801/ 5 * XHTML 1.0 W3C REC: http://www.w3.org/TR/2002/REC-xhtml1-20020801/
6 * 6 *
7 * See Copyright for the status of this software. 7 * See Copyright for the status of this software.
8 * 8 *
9 * daniel@veillard.com 9 * daniel@veillard.com
10 * 10 *
(...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after
1037 1037
1038 if ((__xmlRegisterCallbacks) && (xmlRegisterNodeDefaultValue)) 1038 if ((__xmlRegisterCallbacks) && (xmlRegisterNodeDefaultValue))
1039 xmlRegisterNodeDefaultValue((xmlNodePtr)cur); 1039 xmlRegisterNodeDefaultValue((xmlNodePtr)cur);
1040 return(cur); 1040 return(cur);
1041 } 1041 }
1042 1042
1043 /** 1043 /**
1044 * DICT_FREE: 1044 * DICT_FREE:
1045 * @str: a string 1045 * @str: a string
1046 * 1046 *
1047 * Free a string if it is not owned by the "dict" dictionnary in the 1047 * Free a string if it is not owned by the "dict" dictionary in the
1048 * current scope 1048 * current scope
1049 */ 1049 */
1050 #define DICT_FREE(str) \ 1050 #define DICT_FREE(str) \
1051 if ((str) && ((!dict) || \ 1051 if ((str) && ((!dict) || \
1052 (xmlDictOwns(dict, (const xmlChar *)(str)) == 0))) \ 1052 (xmlDictOwns(dict, (const xmlChar *)(str)) == 0))) \
1053 xmlFree((char *)(str)); 1053 xmlFree((char *)(str));
1054 1054
1055 1055
1056 /** 1056 /**
1057 * DICT_COPY: 1057 * DICT_COPY:
1058 * @str: a string 1058 * @str: a string
1059 * 1059 *
1060 * Copy a string using a "dict" dictionnary in the current scope, 1060 * Copy a string using a "dict" dictionary in the current scope,
1061 * if availabe. 1061 * if availabe.
1062 */ 1062 */
1063 #define DICT_COPY(str, cpy) \ 1063 #define DICT_COPY(str, cpy) \
1064 if (str) { \ 1064 if (str) { \
1065 if (dict) { \ 1065 if (dict) { \
1066 if (xmlDictOwns(dict, (const xmlChar *)(str))) \ 1066 if (xmlDictOwns(dict, (const xmlChar *)(str))) \
1067 cpy = (xmlChar *) (str); \ 1067 cpy = (xmlChar *) (str); \
1068 else \ 1068 else \
1069 cpy = (xmlChar *) xmlDictLookup((dict), (const xmlChar *)(str), -1); \ 1069 cpy = (xmlChar *) xmlDictLookup((dict), (const xmlChar *)(str), -1); \
1070 } else \ 1070 } else \
1071 cpy = xmlStrdup((const xmlChar *)(str)); } 1071 cpy = xmlStrdup((const xmlChar *)(str)); }
1072 1072
1073 /** 1073 /**
1074 * DICT_CONST_COPY: 1074 * DICT_CONST_COPY:
1075 * @str: a string 1075 * @str: a string
1076 * 1076 *
1077 * Copy a string using a "dict" dictionnary in the current scope, 1077 * Copy a string using a "dict" dictionary in the current scope,
1078 * if availabe. 1078 * if availabe.
1079 */ 1079 */
1080 #define DICT_CONST_COPY(str, cpy) \ 1080 #define DICT_CONST_COPY(str, cpy) \
1081 if (str) { \ 1081 if (str) { \
1082 if (dict) { \ 1082 if (dict) { \
1083 if (xmlDictOwns(dict, (const xmlChar *)(str))) \ 1083 if (xmlDictOwns(dict, (const xmlChar *)(str))) \
1084 cpy = (const xmlChar *) (str); \ 1084 cpy = (const xmlChar *) (str); \
1085 else \ 1085 else \
1086 cpy = xmlDictLookup((dict), (const xmlChar *)(str), -1); \ 1086 cpy = xmlDictLookup((dict), (const xmlChar *)(str), -1); \
1087 } else \ 1087 } else \
(...skipping 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after
2263 #endif 2263 #endif
2264 return(NULL); 2264 return(NULL);
2265 } 2265 }
2266 2266
2267 /* 2267 /*
2268 * Allocate a new node and fill the fields. 2268 * Allocate a new node and fill the fields.
2269 */ 2269 */
2270 cur = (xmlNodePtr) xmlMalloc(sizeof(xmlNode)); 2270 cur = (xmlNodePtr) xmlMalloc(sizeof(xmlNode));
2271 if (cur == NULL) { 2271 if (cur == NULL) {
2272 xmlTreeErrMemory("building node"); 2272 xmlTreeErrMemory("building node");
2273 » /* we can't check here that name comes from the doc dictionnary */ 2273 » /* we can't check here that name comes from the doc dictionary */
2274 return(NULL); 2274 return(NULL);
2275 } 2275 }
2276 memset(cur, 0, sizeof(xmlNode)); 2276 memset(cur, 0, sizeof(xmlNode));
2277 cur->type = XML_ELEMENT_NODE; 2277 cur->type = XML_ELEMENT_NODE;
2278 2278
2279 cur->name = name; 2279 cur->name = name;
2280 cur->ns = ns; 2280 cur->ns = ns;
2281 2281
2282 if ((__xmlRegisterCallbacks) && (xmlRegisterNodeDefaultValue)) 2282 if ((__xmlRegisterCallbacks) && (xmlRegisterNodeDefaultValue))
2283 xmlRegisterNodeDefaultValue((xmlNodePtr)cur); 2283 xmlRegisterNodeDefaultValue((xmlNodePtr)cur);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
2343 xmlNodePtr cur; 2343 xmlNodePtr cur;
2344 2344
2345 cur = xmlNewNodeEatName(ns, name); 2345 cur = xmlNewNodeEatName(ns, name);
2346 if (cur != NULL) { 2346 if (cur != NULL) {
2347 cur->doc = doc; 2347 cur->doc = doc;
2348 if (content != NULL) { 2348 if (content != NULL) {
2349 cur->children = xmlStringGetNodeList(doc, content); 2349 cur->children = xmlStringGetNodeList(doc, content);
2350 UPDATE_LAST_CHILD_AND_PARENT(cur) 2350 UPDATE_LAST_CHILD_AND_PARENT(cur)
2351 } 2351 }
2352 } else { 2352 } else {
2353 /* if name don't come from the doc dictionnary free it here */ 2353 /* if name don't come from the doc dictionary free it here */
2354 if ((name != NULL) && (doc != NULL) && 2354 if ((name != NULL) && (doc != NULL) &&
2355 (!(xmlDictOwns(doc->dict, name)))) 2355 (!(xmlDictOwns(doc->dict, name))))
2356 xmlFree(name); 2356 xmlFree(name);
2357 } 2357 }
2358 return(cur); 2358 return(cur);
2359 } 2359 }
2360 2360
2361 #ifdef LIBXML_TREE_ENABLED 2361 #ifdef LIBXML_TREE_ENABLED
2362 /** 2362 /**
2363 * xmlNewDocRawNode: 2363 * xmlNewDocRawNode:
(...skipping 1330 matching lines...) Expand 10 before | Expand all | Expand 10 after
3694 if (((cur->type == XML_ELEMENT_NODE) || 3694 if (((cur->type == XML_ELEMENT_NODE) ||
3695 (cur->type == XML_XINCLUDE_START) || 3695 (cur->type == XML_XINCLUDE_START) ||
3696 (cur->type == XML_XINCLUDE_END)) && 3696 (cur->type == XML_XINCLUDE_END)) &&
3697 (cur->nsDef != NULL)) 3697 (cur->nsDef != NULL))
3698 xmlFreeNsList(cur->nsDef); 3698 xmlFreeNsList(cur->nsDef);
3699 3699
3700 /* 3700 /*
3701 * When a node is a text node or a comment, it uses a global static 3701 * When a node is a text node or a comment, it uses a global static
3702 * variable for the name of the node. 3702 * variable for the name of the node.
3703 * Otherwise the node name might come from the document's 3703 * Otherwise the node name might come from the document's
3704 » * dictionnary 3704 » * dictionary
3705 */ 3705 */
3706 if ((cur->name != NULL) && 3706 if ((cur->name != NULL) &&
3707 (cur->type != XML_TEXT_NODE) && 3707 (cur->type != XML_TEXT_NODE) &&
3708 (cur->type != XML_COMMENT_NODE)) 3708 (cur->type != XML_COMMENT_NODE))
3709 DICT_FREE(cur->name) 3709 DICT_FREE(cur->name)
3710 xmlFree(cur); 3710 xmlFree(cur);
3711 } 3711 }
3712 cur = next; 3712 cur = next;
3713 } 3713 }
3714 } 3714 }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
3763 (cur->type != XML_ENTITY_REF_NODE) && 3763 (cur->type != XML_ENTITY_REF_NODE) &&
3764 (cur->type != XML_XINCLUDE_END) && 3764 (cur->type != XML_XINCLUDE_END) &&
3765 (cur->type != XML_XINCLUDE_START) && 3765 (cur->type != XML_XINCLUDE_START) &&
3766 (cur->content != (xmlChar *) &(cur->properties))) { 3766 (cur->content != (xmlChar *) &(cur->properties))) {
3767 DICT_FREE(cur->content) 3767 DICT_FREE(cur->content)
3768 } 3768 }
3769 3769
3770 /* 3770 /*
3771 * When a node is a text node or a comment, it uses a global static 3771 * When a node is a text node or a comment, it uses a global static
3772 * variable for the name of the node. 3772 * variable for the name of the node.
3773 * Otherwise the node name might come from the document's dictionnary 3773 * Otherwise the node name might come from the document's dictionary
3774 */ 3774 */
3775 if ((cur->name != NULL) && 3775 if ((cur->name != NULL) &&
3776 (cur->type != XML_TEXT_NODE) && 3776 (cur->type != XML_TEXT_NODE) &&
3777 (cur->type != XML_COMMENT_NODE)) 3777 (cur->type != XML_COMMENT_NODE))
3778 DICT_FREE(cur->name) 3778 DICT_FREE(cur->name)
3779 3779
3780 if (((cur->type == XML_ELEMENT_NODE) || 3780 if (((cur->type == XML_ELEMENT_NODE) ||
3781 (cur->type == XML_XINCLUDE_START) || 3781 (cur->type == XML_XINCLUDE_START) ||
3782 (cur->type == XML_XINCLUDE_END)) && 3782 (cur->type == XML_XINCLUDE_END)) &&
3783 (cur->nsDef != NULL)) 3783 (cur->nsDef != NULL))
(...skipping 6328 matching lines...) Expand 10 before | Expand all | Expand 10 after
10112 } 10112 }
10113 default: 10113 default:
10114 break; 10114 break;
10115 } 10115 }
10116 } 10116 }
10117 return (0); 10117 return (0);
10118 } 10118 }
10119 10119
10120 #define bottom_tree 10120 #define bottom_tree
10121 #include "elfgcchack.h" 10121 #include "elfgcchack.h"
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698