MCPcopy Create free account
hub / github.com/acl-dev/acl / acl_xml_decode2

Function acl_xml_decode2

lib_acl/src/code/acl_xmlcode.c:313–360  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

311}
312
313const char *acl_xml_decode2(const char *in, char **out, size_t *size)
314{
315 size_t len;
316 const char *ptr = in, *pre;
317 const ACL_TOKEN *token;
318 const XML_SPEC *spec;
319
320 if (*size == 0)
321 return in;
322
323 *size -= 1; /* reserve space for '\0' */
324
325 acl_pthread_once(&__token_once, xml_decode_init);
326 if (__token_tree == NULL)
327 acl_msg_fatal("__token_tree null");
328
329 while (*ptr != 0) {
330 pre = ptr;
331 token = acl_token_tree_match(__token_tree, &ptr, NULL, NULL);
332 if (token == NULL) {
333 pre = markup_unescape2(pre, out, size);
334 if (*size == 0)
335 break;
336
337 if (ptr > pre)
338 (void) copy_buf(out, size, pre, ptr - pre);
339 break;
340 }
341
342 spec = (const XML_SPEC*) token->ctx;
343 acl_assert(spec != NULL);
344
345 len = ptr - pre - spec->len;
346 if (len > 0)
347 copy_buf(out, size, pre, len);
348
349 if (*size == 0)
350 break;
351
352 (void) copy_buf(out, size, spec->str, strlen(spec->str));
353 if (*size == 0)
354 break;
355 }
356
357 **out = '\0';
358 *out += 1;
359 return ptr;
360}
361
362#endif /* ACL_CLIENT_ONLY */

Callers

nothing calls this directly

Calls 5

acl_pthread_onceFunction · 0.85
acl_msg_fatalFunction · 0.85
acl_token_tree_matchFunction · 0.85
markup_unescape2Function · 0.85
copy_bufFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…