1 | #ifndef CMARK_HOUDINI_H |
2 | #define CMARK_HOUDINI_H |
3 | |
4 | #ifdef __cplusplus |
5 | extern "C" { |
6 | #endif |
7 | |
8 | #include <stdint.h> |
9 | #include "config.h" |
10 | #include "buffer.h" |
11 | |
12 | #ifdef HAVE___BUILTIN_EXPECT |
13 | #define likely(x) __builtin_expect((x), 1) |
14 | #define unlikely(x) __builtin_expect((x), 0) |
15 | #else |
16 | #define likely(x) (x) |
17 | #define unlikely(x) (x) |
18 | #endif |
19 | |
20 | #ifdef HOUDINI_USE_LOCALE |
21 | #define _isxdigit(c) isxdigit(c) |
22 | #define _isdigit(c) isdigit(c) |
23 | #else |
24 | /* |
25 | * Helper _isdigit methods -- do not trust the current locale |
26 | * */ |
27 | #define _isxdigit(c) (strchr("0123456789ABCDEFabcdef", (c)) != NULL) |
28 | #define _isdigit(c) ((c) >= '0' && (c) <= '9') |
29 | #endif |
30 | |
31 | #define HOUDINI_ESCAPED_SIZE(x) (((x)*12) / 10) |
32 | #define HOUDINI_UNESCAPED_SIZE(x) (x) |
33 | |
34 | extern bufsize_t houdini_unescape_ent(cmark_strbuf *ob, const uint8_t *src, |
35 | bufsize_t size); |
36 | extern int houdini_escape_html(cmark_strbuf *ob, const uint8_t *src, |
37 | bufsize_t size); |
38 | extern int houdini_escape_html0(cmark_strbuf *ob, const uint8_t *src, |
39 | bufsize_t size, int secure); |
40 | extern int houdini_unescape_html(cmark_strbuf *ob, const uint8_t *src, |
41 | bufsize_t size); |
42 | extern void houdini_unescape_html_f(cmark_strbuf *ob, const uint8_t *src, |
43 | bufsize_t size); |
44 | extern int houdini_escape_href(cmark_strbuf *ob, const uint8_t *src, |
45 | bufsize_t size); |
46 | |
47 | #ifdef __cplusplus |
48 | } |
49 | #endif |
50 | |
51 | #endif |
52 | |