Changeset 42945 in webkit for trunk/WebCore/dom/XMLTokenizerLibxml2.cpp
- Timestamp:
- Apr 28, 2009, 11:57:58 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/dom/XMLTokenizerLibxml2.cpp
r42738 r42945 1065 1065 } 1066 1066 1067 // Using a global variableentity and marking it XML_INTERNAL_PREDEFINED_ENTITY is1067 // Using a static entity and marking it XML_INTERNAL_PREDEFINED_ENTITY is 1068 1068 // a hack to avoid malloc/free. Using a global variable like this could cause trouble 1069 1069 // if libxml implementation details were to change 1070 static xmlChar sharedXHTMLEntityResult[5] = {0,0,0,0,0}; 1071 static xmlEntity sharedXHTMLEntity = { 1072 0, XML_ENTITY_DECL, 0, 0, 0, 0, 0, 0, 0, 1073 sharedXHTMLEntityResult, sharedXHTMLEntityResult, 0, 1074 XML_INTERNAL_PREDEFINED_ENTITY, 0, 0, 0, 0, 0, 1075 #if LIBXML_VERSION >= 20627 1076 // xmlEntity gained an extra member in 2.6.27. 1077 1 1078 #endif 1079 }; 1070 static xmlChar sharedXHTMLEntityResult[5] = {0, 0, 0, 0, 0}; 1071 1072 static xmlEntityPtr sharedXHTMLEntity() 1073 { 1074 static xmlEntity entity; 1075 if (!entity.type) { 1076 entity.type = XML_ENTITY_DECL; 1077 entity.orig = sharedXHTMLEntityResult; 1078 entity.content = sharedXHTMLEntityResult; 1079 entity.etype = XML_INTERNAL_PREDEFINED_ENTITY; 1080 } 1081 return &entity; 1082 } 1080 1083 1081 1084 static xmlEntityPtr getXHTMLEntity(const xmlChar* name) … … 1087 1090 CString value = String(&c, 1).utf8(); 1088 1091 ASSERT(value.length() < 5); 1089 sharedXHTMLEntity.length = value.length(); 1090 sharedXHTMLEntity.name = name; 1091 memcpy(sharedXHTMLEntityResult, value.data(), sharedXHTMLEntity.length + 1); 1092 1093 return &sharedXHTMLEntity; 1092 xmlEntityPtr entity = sharedXHTMLEntity(); 1093 entity->length = value.length(); 1094 entity->name = name; 1095 memcpy(sharedXHTMLEntityResult, value.data(), entity->length + 1); 1096 1097 return entity; 1094 1098 } 1095 1099
Note:
See TracChangeset
for help on using the changeset viewer.