redcarpet 1.17.2 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,6 @@
1
- /* buffer.c - automatic buffer structure */
2
-
3
1
  /*
4
2
  * Copyright (c) 2008, Natacha Porté
3
+ * Copyright (c) 2011, Vicent Martí
5
4
  *
6
5
  * Permission to use, copy, modify, and distribute this software for any
7
6
  * purpose with or without fee is hereby granted, provided that the above
@@ -16,13 +15,6 @@
16
15
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17
16
  */
18
17
 
19
- /*
20
- * COMPILE TIME OPTIONS
21
- *
22
- * BUFFER_STATS • if defined, stats are kept about memory usage
23
- */
24
-
25
- #define BUFFER_STDARG
26
18
  #define BUFFER_MAX_ALLOC_SIZE (1024 * 1024 * 16) //16mb
27
19
 
28
20
  #include "buffer.h"
@@ -31,78 +23,13 @@
31
23
  #include <stdlib.h>
32
24
  #include <string.h>
33
25
 
34
-
35
- /********************
36
- * GLOBAL VARIABLES *
37
- ********************/
38
-
39
- #ifdef BUFFER_STATS
40
- long buffer_stat_nb = 0;
41
- size_t buffer_stat_alloc_bytes = 0;
26
+ /* MSVC compat */
27
+ #if defined(_MSC_VER)
28
+ # define _buf_vsnprintf _vsnprintf
29
+ #else
30
+ # define _buf_vsnprintf vsnprintf
42
31
  #endif
43
32
 
44
-
45
- /***************************
46
- * STATIC HELPER FUNCTIONS *
47
- ***************************/
48
-
49
- /* lower • retruns the lower-case variant of the input char */
50
- static char
51
- lower(char c) {
52
- return (c >= 'A' && c <= 'Z') ? (c - 'A' + 'a') : c; }
53
-
54
-
55
-
56
- /********************
57
- * BUFFER FUNCTIONS *
58
- ********************/
59
-
60
- /* bufcasecmp • case-insensitive buffer comparison */
61
- int
62
- bufcasecmp(const struct buf *a, const struct buf *b) {
63
- size_t i = 0;
64
- size_t cmplen;
65
- if (a == b) return 0;
66
- if (!a) return -1; else if (!b) return 1;
67
- cmplen = (a->size < b->size) ? a->size : b->size;
68
- while (i < cmplen && lower(a->data[i]) == lower(b->data[i])) ++i;
69
- if (i < a->size) {
70
- if (i < b->size) return lower(a->data[i]) - lower(b->data[i]);
71
- else return 1; }
72
- else { if (i < b->size) return -1;
73
- else return 0; } }
74
-
75
-
76
- /* bufcmp • case-sensitive buffer comparison */
77
- int
78
- bufcmp(const struct buf *a, const struct buf *b) {
79
- size_t i = 0;
80
- size_t cmplen;
81
- if (a == b) return 0;
82
- if (!a) return -1; else if (!b) return 1;
83
- cmplen = (a->size < b->size) ? a->size : b->size;
84
- while (i < cmplen && a->data[i] == b->data[i]) ++i;
85
- if (i < a->size) {
86
- if (i < b->size) return a->data[i] - b->data[i];
87
- else return 1; }
88
- else { if (i < b->size) return -1;
89
- else return 0; } }
90
-
91
-
92
- /* bufcmps • case-sensitive comparison of a string to a buffer */
93
- int
94
- bufcmps(const struct buf *a, const char *b) {
95
- const size_t len = strlen(b);
96
- size_t cmplen = len;
97
- int r;
98
- if (!a || !a->size) return b ? 0 : -1;
99
- if (len < a->size) cmplen = a->size;
100
- r = strncmp(a->data, b, cmplen);
101
- if (r) return r;
102
- else if (a->size == len) return 0;
103
- else if (a->size < len) return -1;
104
- else return 1; }
105
-
106
33
  int
107
34
  bufprefix(const struct buf *buf, const char *prefix)
108
35
  {
@@ -119,205 +46,184 @@ bufprefix(const struct buf *buf, const char *prefix)
119
46
  return 0;
120
47
  }
121
48
 
122
-
123
- /* bufdup • buffer duplication */
124
- struct buf *
125
- bufdup(const struct buf *src, size_t dupunit) {
126
- size_t blocks;
127
- struct buf *ret;
128
- if (src == 0) return 0;
129
- ret = malloc(sizeof (struct buf));
130
- if (ret == 0) return 0;
131
- ret->unit = dupunit;
132
- ret->size = src->size;
133
- ret->ref = 1;
134
- if (!src->size) {
135
- ret->asize = 0;
136
- ret->data = 0;
137
- return ret; }
138
- blocks = (src->size + dupunit - 1) / dupunit;
139
- ret->asize = blocks * dupunit;
140
- ret->data = malloc(ret->asize);
141
- if (ret->data == 0) {
142
- free(ret);
143
- return 0; }
144
- memcpy(ret->data, src->data, src->size);
145
- #ifdef BUFFER_STATS
146
- buffer_stat_nb += 1;
147
- buffer_stat_alloc_bytes += ret->asize;
148
- #endif
149
- return ret; }
150
-
151
- /* bufgrow • increasing the allocated size to the given value */
49
+ /* bufgrow: increasing the allocated size to the given value */
152
50
  int
153
- bufgrow(struct buf *buf, size_t neosz) {
51
+ bufgrow(struct buf *buf, size_t neosz)
52
+ {
154
53
  size_t neoasz;
155
54
  void *neodata;
156
- if (!buf || !buf->unit || neosz > BUFFER_MAX_ALLOC_SIZE) return 0;
157
- if (buf->asize >= neosz) return 1;
55
+ if (!buf || !buf->unit || neosz > BUFFER_MAX_ALLOC_SIZE)
56
+ return BUF_ENOMEM;
57
+
58
+ if (buf->asize >= neosz)
59
+ return BUF_OK;
60
+
158
61
  neoasz = buf->asize + buf->unit;
159
- while (neoasz < neosz) neoasz += buf->unit;
62
+ while (neoasz < neosz)
63
+ neoasz += buf->unit;
64
+
160
65
  neodata = realloc(buf->data, neoasz);
161
- if (!neodata) return 0;
162
- #ifdef BUFFER_STATS
163
- buffer_stat_alloc_bytes += (neoasz - buf->asize);
164
- #endif
66
+ if (!neodata)
67
+ return BUF_ENOMEM;
68
+
165
69
  buf->data = neodata;
166
70
  buf->asize = neoasz;
167
- return 1; }
71
+ return BUF_OK;
72
+ }
168
73
 
169
74
 
170
- /* bufnew allocation of a new buffer */
75
+ /* bufnew: allocation of a new buffer */
171
76
  struct buf *
172
- bufnew(size_t unit) {
77
+ bufnew(size_t unit)
78
+ {
173
79
  struct buf *ret;
174
80
  ret = malloc(sizeof (struct buf));
81
+
175
82
  if (ret) {
176
- #ifdef BUFFER_STATS
177
- buffer_stat_nb += 1;
178
- #endif
179
83
  ret->data = 0;
180
84
  ret->size = ret->asize = 0;
181
- ret->ref = 1;
182
- ret->unit = unit; }
183
- return ret; }
85
+ ret->unit = unit;
86
+ }
87
+ return ret;
88
+ }
89
+
90
+ /* bufnullterm: NULL-termination of the string array */
91
+ const char *
92
+ bufcstr(struct buf *buf)
93
+ {
94
+ if (!buf || !buf->unit)
95
+ return NULL;
184
96
 
97
+ if (buf->size < buf->asize && buf->data[buf->size] == 0)
98
+ return (char *)buf->data;
185
99
 
186
- /* bufnullterm NUL-termination of the string array (making a C-string) */
187
- void
188
- bufnullterm(struct buf *buf) {
189
- if (!buf || !buf->unit) return;
190
- if (buf->size < buf->asize && buf->data[buf->size] == 0) return;
191
- if (buf->size + 1 <= buf->asize || bufgrow(buf, buf->size + 1))
192
- buf->data[buf->size] = 0; }
100
+ if (buf->size + 1 <= buf->asize || bufgrow(buf, buf->size + 1) == 0) {
101
+ buf->data[buf->size] = 0;
102
+ return (char *)buf->data;
103
+ }
193
104
 
105
+ return NULL;
106
+ }
194
107
 
195
- /* bufprintf formatted printing to a buffer */
108
+ /* bufprintf: formatted printing to a buffer */
196
109
  void
197
- bufprintf(struct buf *buf, const char *fmt, ...) {
110
+ bufprintf(struct buf *buf, const char *fmt, ...)
111
+ {
198
112
  va_list ap;
199
- if (!buf || !buf->unit) return;
200
- va_start(ap, fmt);
201
- vbufprintf(buf, fmt, ap);
202
- va_end(ap); }
113
+ if (!buf || !buf->unit)
114
+ return;
203
115
 
116
+ int n;
204
117
 
205
- /* bufput appends raw data to a buffer */
206
- void
207
- bufput(struct buf *buf, const void *data, size_t len) {
208
- if (!buf) return;
209
- if (buf->size + len > buf->asize && !bufgrow(buf, buf->size + len))
118
+ if (buf == 0 || (buf->size >= buf->asize && bufgrow(buf, buf->size + 1)) < 0)
210
119
  return;
211
- memcpy(buf->data + buf->size, data, len);
212
- buf->size += len; }
213
-
120
+
121
+ va_start(ap, fmt);
122
+ n = _buf_vsnprintf((char *)buf->data + buf->size, buf->asize - buf->size, fmt, ap);
123
+ va_end(ap);
214
124
 
215
- /* bufputs appends a NUL-terminated string to a buffer */
216
- void
217
- bufputs(struct buf *buf, const char *str) {
218
- bufput(buf, str, strlen (str)); }
125
+ if (n < 0) {
126
+ #ifdef _MSC_VER
127
+ n = _vscprintf(fmt, ap);
128
+ #else
129
+ return;
130
+ #endif
131
+ }
219
132
 
133
+ if ((size_t)n >= buf->asize - buf->size) {
134
+ if (bufgrow(buf, buf->size + n + 1) < 0)
135
+ return;
136
+ va_start(ap, fmt);
137
+ n = _buf_vsnprintf((char *)buf->data + buf->size, buf->asize - buf->size, fmt, ap);
138
+ va_end(ap);
139
+ }
220
140
 
221
- /* bufputc appends a single char to a buffer */
222
- void
223
- bufputc(struct buf *buf, char c) {
224
- if (!buf) return;
225
- if (buf->size + 1 > buf->asize && !bufgrow(buf, buf->size + 1))
141
+ if (n < 0)
226
142
  return;
227
- buf->data[buf->size] = c;
228
- buf->size += 1; }
229
143
 
144
+ buf->size += n;
145
+ }
230
146
 
231
- /* bufrelease decrease the reference count and free the buffer if needed */
147
+ /* bufput: appends raw data to a buffer */
232
148
  void
233
- bufrelease(struct buf *buf) {
234
- if (!buf) return;
235
- buf->ref -= 1;
236
- if (buf->ref == 0) {
237
- #ifdef BUFFER_STATS
238
- buffer_stat_nb -= 1;
239
- buffer_stat_alloc_bytes -= buf->asize;
240
- #endif
241
- free(buf->data);
242
- free(buf); } }
149
+ bufput(struct buf *buf, const void *data, size_t len)
150
+ {
151
+ if (!buf)
152
+ return;
243
153
 
154
+ if (buf->size + len > buf->asize && bufgrow(buf, buf->size + len) < 0)
155
+ return;
156
+
157
+ memcpy(buf->data + buf->size, data, len);
158
+ buf->size += len;
159
+ }
244
160
 
245
- /* bufreset frees internal data of the buffer */
161
+ /* bufputs: appends a NUL-terminated string to a buffer */
246
162
  void
247
- bufreset(struct buf *buf) {
248
- if (!buf) return;
249
- #ifdef BUFFER_STATS
250
- buffer_stat_alloc_bytes -= buf->asize;
251
- #endif
252
- free(buf->data);
253
- buf->data = 0;
254
- buf->size = buf->asize = 0; }
163
+ bufputs(struct buf *buf, const char *str)
164
+ {
165
+ bufput(buf, str, strlen(str));
166
+ }
255
167
 
256
168
 
257
- /* bufset safely assigns a buffer to another */
169
+ /* bufputc: appends a single uint8_t to a buffer */
258
170
  void
259
- bufset(struct buf **dest, struct buf *src) {
260
- if (src) {
261
- if (!src->asize) src = bufdup(src, 1);
262
- else src->ref += 1; }
263
- bufrelease(*dest);
264
- *dest = src; }
171
+ bufputc(struct buf *buf, int c)
172
+ {
173
+ if (!buf)
174
+ return;
265
175
 
176
+ if (buf->size + 1 > buf->asize && bufgrow(buf, buf->size + 1) < 0)
177
+ return;
178
+
179
+ buf->data[buf->size] = c;
180
+ buf->size += 1;
181
+ }
266
182
 
267
- /* bufslurp removes a given number of bytes from the head of the array */
183
+ /* bufrelease: decrease the reference count and free the buffer if needed */
268
184
  void
269
- bufslurp(struct buf *buf, size_t len) {
270
- if (!buf || !buf->unit || len <= 0) return;
271
- if (len >= buf->size) {
272
- buf->size = 0;
273
- return; }
274
- buf->size -= len;
275
- memmove(buf->data, buf->data + len, buf->size); }
185
+ bufrelease(struct buf *buf)
186
+ {
187
+ if (!buf)
188
+ return;
276
189
 
190
+ free(buf->data);
191
+ free(buf);
192
+ }
277
193
 
278
- /* buftoi • converts the numbers at the beginning of the buf into an int */
279
- int
280
- buftoi(struct buf *buf, size_t offset_i, size_t *offset_o) {
281
- int r = 0, neg = 0;
282
- size_t i = offset_i;
283
- if (!buf || !buf->size) return 0;
284
- if (buf->data[i] == '+') i += 1;
285
- else if (buf->data[i] == '-') {
286
- neg = 1;
287
- i += 1; }
288
- while (i < buf->size && buf->data[i] >= '0' && buf->data[i] <= '9') {
289
- r = (r * 10) + buf->data[i] - '0';
290
- i += 1; }
291
- if (offset_o) *offset_o = i;
292
- return neg ? -r : r; }
293
-
294
-
295
-
296
- /* vbufprintf • stdarg variant of formatted printing into a buffer */
194
+
195
+ /* bufreset: frees internal data of the buffer */
297
196
  void
298
- vbufprintf(struct buf *buf, const char *fmt, va_list ap) {
299
- int n;
300
- va_list ap_save;
301
- if (buf == 0
302
- || (buf->size >= buf->asize && !bufgrow (buf, buf->size + 1)))
197
+ bufreset(struct buf *buf)
198
+ {
199
+ if (!buf)
303
200
  return;
304
201
 
305
- va_copy(ap_save, ap);
306
- n = vsnprintf(buf->data + buf->size, buf->asize - buf->size, fmt, ap);
202
+ free(buf->data);
203
+ buf->data = NULL;
204
+ buf->size = buf->asize = 0;
205
+ }
307
206
 
308
- if (n < 0 || (size_t)n >= buf->asize - buf->size) {
309
- size_t new_size = (n > 0) ? n : buf->size;
310
- if (!bufgrow (buf, buf->size + new_size + 1))
311
- return;
207
+ /* bufslurp: removes a given number of bytes from the head of the array */
208
+ void
209
+ bufslurp(struct buf *buf, size_t len)
210
+ {
211
+ if (!buf || !buf->unit || len <= 0)
212
+ return;
312
213
 
313
- n = vsnprintf(buf->data + buf->size, buf->asize - buf->size, fmt, ap_save);
214
+ if (len >= buf->size) {
215
+ buf->size = 0;
216
+ return;
314
217
  }
315
- va_end(ap_save);
316
218
 
317
- if (n < 0)
318
- return;
219
+ buf->size -= len;
220
+ memmove(buf->data, buf->data + len, buf->size);
221
+ }
222
+
223
+ /* vbufprintf: stdarg variant of formatted printing into a buffer */
224
+ void
225
+ vbufprintf(struct buf *buf, const char *fmt, va_list ap)
226
+ {
319
227
 
320
- buf->size += n;
321
228
  }
322
229
 
323
- /* vim: set filetype=c: */
@@ -1,7 +1,6 @@
1
- /* buffer.h - automatic buffer structure */
2
-
3
1
  /*
4
2
  * Copyright (c) 2008, Natacha Porté
3
+ * Copyright (c) 2011, Vicent Martí
5
4
  *
6
5
  * Permission to use, copy, modify, and distribute this software for any
7
6
  * purpose with or without fee is hereby granted, provided that the above
@@ -16,139 +15,74 @@
16
15
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17
16
  */
18
17
 
19
- #ifndef LITHIUM_BUFFER_H
20
- #define LITHIUM_BUFFER_H
18
+ #ifndef BUFFER_H__
19
+ #define BUFFER_H__
21
20
 
22
21
  #include <stddef.h>
22
+ #include <stdarg.h>
23
+ #include <stdint.h>
23
24
 
24
25
  #if defined(_MSC_VER)
25
26
  #define __attribute__(x)
26
27
  #define inline
27
- #define strncasecmp _strnicmp
28
- #define snprintf _snprintf
29
- #define va_copy(d,s) ((d) = (s))
30
28
  #endif
31
29
 
32
- /********************
33
- * TYPE DEFINITIONS *
34
- ********************/
30
+ typedef enum {
31
+ BUF_OK = 0,
32
+ BUF_ENOMEM = -1,
33
+ } buferror_t;
35
34
 
36
- /* struct buf character array buffer */
35
+ /* struct buf: character array buffer */
37
36
  struct buf {
38
- char * data; /* actual character data */
39
- size_t size; /* size of the string */
40
- size_t asize; /* allocated size (0 = volatile buffer) */
41
- size_t unit; /* reallocation unit size (0 = read-only buffer) */
42
- int ref; }; /* reference count */
43
-
44
- /**********
45
- * MACROS *
46
- **********/
47
-
48
- #define STRLEN(x) (sizeof(x) - 1)
49
-
50
- /* CONST_BUF • global buffer from a string litteral */
51
- #define CONST_BUF(name, string) \
52
- static struct buf name = { string, sizeof string -1, sizeof string }
53
-
54
-
55
- /* VOLATILE_BUF • macro for creating a volatile buffer on the stack */
56
- #define VOLATILE_BUF(name, strname) \
57
- struct buf name = { strname, strlen(strname) }
58
-
59
-
60
- /* BUFPUTSL • optimized bufputs of a string litteral */
61
- #define BUFPUTSL(output, litteral) \
62
- bufput(output, litteral, sizeof litteral - 1)
63
-
64
-
65
-
66
- /********************
67
- * BUFFER FUNCTIONS *
68
- ********************/
37
+ uint8_t *data; /* actual character data */
38
+ size_t size; /* size of the string */
39
+ size_t asize; /* allocated size (0 = volatile buffer) */
40
+ size_t unit; /* reallocation unit size (0 = read-only buffer) */
41
+ };
69
42
 
70
- /* bufcasecmp case-insensitive buffer comparison */
71
- int
72
- bufcasecmp(const struct buf *, const struct buf *);
43
+ /* CONST_BUF: global buffer from a string litteral */
44
+ #define BUF_STATIC(string) \
45
+ { (uint8_t *)string, sizeof string -1, sizeof string, 0, 0 }
73
46
 
74
- /* bufcmp case-sensitive buffer comparison */
75
- int
76
- bufcmp(const struct buf *, const struct buf *);
47
+ /* VOLATILE_BUF: macro for creating a volatile buffer on the stack */
48
+ #define BUF_VOLATILE(strname) \
49
+ { (uint8_t *)strname, strlen(strname), 0, 0, 0 }
77
50
 
78
- /* bufcmps case-sensitive comparison of a string to a buffer */
79
- int
80
- bufcmps(const struct buf *, const char *);
51
+ /* BUFPUTSL: optimized bufputs of a string litteral */
52
+ #define BUFPUTSL(output, literal) \
53
+ bufput(output, literal, sizeof literal - 1)
81
54
 
82
- /* bufprefix * compare the beginning of a buffer with a string */
83
- int
84
- bufprefix(const struct buf *buf, const char *prefix);
55
+ /* bufgrow: increasing the allocated size to the given value */
56
+ int bufgrow(struct buf *, size_t);
85
57
 
86
- /* bufdup buffer duplication */
87
- struct buf *
88
- bufdup(const struct buf *, size_t)
89
- __attribute__ ((malloc));
58
+ /* bufnew: allocation of a new buffer */
59
+ struct buf *bufnew(size_t) __attribute__ ((malloc));
90
60
 
91
- /* bufgrow increasing the allocated size to the given value */
92
- int
93
- bufgrow(struct buf *, size_t);
61
+ /* bufnullterm: NUL-termination of the string array (making a C-string) */
62
+ const char *bufcstr(struct buf *);
94
63
 
95
- /* bufnew allocation of a new buffer */
96
- struct buf *
97
- bufnew(size_t)
98
- __attribute__ ((malloc));
64
+ /* bufprefix: compare the beginning of a buffer with a string */
65
+ int bufprefix(const struct buf *buf, const char *prefix);
99
66
 
100
- /* bufnullterm NUL-termination of the string array (making a C-string) */
101
- void
102
- bufnullterm(struct buf *);
67
+ /* bufput: appends raw data to a buffer */
68
+ void bufput(struct buf *, const void *, size_t);
103
69
 
104
- /* bufprintf formatted printing to a buffer */
105
- void
106
- bufprintf(struct buf *, const char *, ...)
107
- __attribute__ ((format (printf, 2, 3)));
70
+ /* bufputs: appends a NUL-terminated string to a buffer */
71
+ void bufputs(struct buf *, const char *);
108
72
 
109
- /* bufput appends raw data to a buffer */
110
- void
111
- bufput(struct buf *, const void*, size_t);
73
+ /* bufputc: appends a single char to a buffer */
74
+ void bufputc(struct buf *, int);
112
75
 
113
- /* bufputs appends a NUL-terminated string to a buffer */
114
- void
115
- bufputs(struct buf *, const char*);
76
+ /* bufrelease: decrease the reference count and free the buffer if needed */
77
+ void bufrelease(struct buf *);
116
78
 
117
- /* bufputc appends a single char to a buffer */
118
- void
119
- bufputc(struct buf *, char);
79
+ /* bufreset: frees internal data of the buffer */
80
+ void bufreset(struct buf *);
120
81
 
121
- /* bufrelease decrease the reference count and free the buffer if needed */
122
- void
123
- bufrelease(struct buf *);
82
+ /* bufslurp: removes a given number of bytes from the head of the array */
83
+ void bufslurp(struct buf *, size_t);
124
84
 
125
- /* bufreset frees internal data of the buffer */
126
- void
127
- bufreset(struct buf *);
85
+ /* bufprintf: formatted printing to a buffer */
86
+ void bufprintf(struct buf *, const char *, ...) __attribute__ ((format (printf, 2, 3)));
128
87
 
129
- /* bufset • safely assigns a buffer to another */
130
- void
131
- bufset(struct buf **, struct buf *);
132
-
133
- /* bufslurp • removes a given number of bytes from the head of the array */
134
- void
135
- bufslurp(struct buf *, size_t);
136
-
137
- /* buftoi • converts the numbers at the beginning of the buf into an int */
138
- int
139
- buftoi(struct buf *, size_t, size_t *);
140
-
141
-
142
-
143
- #ifdef BUFFER_STDARG
144
- #include <stdarg.h>
145
-
146
- /* vbufprintf • stdarg variant of formatted printing into a buffer */
147
- void
148
- vbufprintf(struct buf *, const char*, va_list);
149
-
150
- #endif /* def BUFFER_STDARG */
151
-
152
- #endif /* ndef LITHIUM_BUFFER_H */
153
-
154
- /* vim: set filetype=c: */
88
+ #endif
@@ -0,0 +1,29 @@
1
+ #ifndef HOUDINI_H__
2
+ #define HOUDINI_H__
3
+
4
+ #include "buffer.h"
5
+
6
+ #ifdef HOUDINI_USE_LOCALE
7
+ # define _isxdigit(c) isxdigit(c)
8
+ # define _isdigit(c) isdigit(c)
9
+ #else
10
+ /*
11
+ * Helper _isdigit methods -- do not trust the current locale
12
+ * */
13
+ # define _isxdigit(c) (strchr("0123456789ABCDEFabcdef", (c)) != NULL)
14
+ # define _isdigit(c) ((c) >= '0' && (c) <= '9')
15
+ #endif
16
+
17
+ extern void houdini_escape_html(struct buf *ob, const uint8_t *src, size_t size);
18
+ extern void houdini_escape_html0(struct buf *ob, const uint8_t *src, size_t size, int secure);
19
+ extern void houdini_unescape_html(struct buf *ob, const uint8_t *src, size_t size);
20
+ extern void houdini_escape_xml(struct buf *ob, const uint8_t *src, size_t size);
21
+ extern void houdini_escape_uri(struct buf *ob, const uint8_t *src, size_t size);
22
+ extern void houdini_escape_url(struct buf *ob, const uint8_t *src, size_t size);
23
+ extern void houdini_escape_href(struct buf *ob, const uint8_t *src, size_t size);
24
+ extern void houdini_unescape_uri(struct buf *ob, const uint8_t *src, size_t size);
25
+ extern void houdini_unescape_url(struct buf *ob, const uint8_t *src, size_t size);
26
+ extern void houdini_escape_js(struct buf *ob, const uint8_t *src, size_t size);
27
+ extern void houdini_unescape_js(struct buf *ob, const uint8_t *src, size_t size);
28
+
29
+ #endif