MCPcopy Create free account
hub / github.com/Kitware/VTK / xmlSchemaCollapseString

Function xmlSchemaCollapseString

ThirdParty/libxml2/vtklibxml2/xmlschemastypes.c:2228–2270  ·  view source on GitHub ↗

* xmlSchemaCollapseString: * @value: a value * * Removes and normalize white spaces in the string * * Returns the new string or NULL if no change was required. */

Source from the content-addressed store, hash-verified

2226 * Returns the new string or NULL if no change was required.
2227 */
2228xmlChar *
2229xmlSchemaCollapseString(const xmlChar *value) {
2230 const xmlChar *start = value, *end, *f;
2231 xmlChar *g;
2232 int col = 0;
2233
2234 if (value == NULL) return(NULL);
2235 while ((*start != 0) && (IS_BLANK_CH(*start))) start++;
2236 end = start;
2237 while (*end != 0) {
2238 if ((*end == ' ') && (IS_BLANK_CH(end[1]))) {
2239 col = end - start;
2240 break;
2241 } else if ((*end == 0xa) || (*end == 0x9) || (*end == 0xd)) {
2242 col = end - start;
2243 break;
2244 }
2245 end++;
2246 }
2247 if (col == 0) {
2248 f = end;
2249 end--;
2250 while ((end > start) && (IS_BLANK_CH(*end))) end--;
2251 end++;
2252 if ((start == value) && (f == end)) return(NULL);
2253 return(xmlStrndup(start, end - start));
2254 }
2255 start = xmlStrdup(start);
2256 if (start == NULL) return(NULL);
2257 g = (xmlChar *) (start + col);
2258 end = g;
2259 while (*end != 0) {
2260 if (IS_BLANK_CH(*end)) {
2261 end++;
2262 while (IS_BLANK_CH(*end)) end++;
2263 if (*end != 0)
2264 *g++ = ' ';
2265 } else
2266 *g++ = *end++;
2267 }
2268 *g = 0;
2269 return((xmlChar *) start);
2270}
2271
2272/**
2273 * xmlSchemaValAtomicListNode:

Callers 7

xmlSchemaPValAttrNodeIDFunction · 0.85
xmlSchemaNormalizeValueFunction · 0.85
xmlSchemaValidateQNameFunction · 0.85
xmlSchemaValAtomicTypeFunction · 0.85
xmlSchemaGetCanonValueFunction · 0.85

Calls 2

xmlStrndupFunction · 0.85
xmlStrdupFunction · 0.85

Tested by

no test coverage detected