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

Function acl_html_decode

lib_acl/src/code/acl_htmlcode.c:115–152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

113}
114
115int acl_html_decode(const char *in, ACL_VSTRING *out)
116{
117 int n = 0, len;
118 const char *ptr = in, *pre;
119 const ACL_TOKEN *token;
120 const HTML_SPEC *spec;
121
122 acl_pthread_once(&__decode_token_once, html_decode_init);
123 if (__decode_token_tree == NULL)
124 acl_msg_fatal("__decode_token_tree null");
125
126 while (*ptr != 0) {
127 pre = ptr;
128 token = acl_token_tree_match(__decode_token_tree,
129 &ptr, NULL, NULL);
130 if (token == NULL) {
131 pre = markup_unescape(pre, out);
132 len = (int) (ptr - pre);
133 if (len > 0)
134 acl_vstring_memcat(out, pre, len);
135 break;
136 }
137 spec = (const HTML_SPEC*) token->ctx;
138 acl_assert(spec != NULL);
139
140 len = (int) (ptr - pre - spec->len);
141 if (len > 0)
142 acl_vstring_memcat(out, pre, len);
143 if (spec->ch > 255)
144 acl_vstring_memcat(out, (char*) &spec->ch, sizeof(spec->ch));
145 else
146 ACL_VSTRING_ADDCH(out, (unsigned char) spec->ch);
147 n++;
148 }
149
150 ACL_VSTRING_TERMINATE(out);
151 return (n);
152}
153
154#endif /* ACL_CLIENT_ONLY */

Callers 2

mainFunction · 0.85
mainFunction · 0.85

Calls 5

acl_pthread_onceFunction · 0.85
acl_msg_fatalFunction · 0.85
acl_token_tree_matchFunction · 0.85
acl_vstring_memcatFunction · 0.85
markup_unescapeFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…