forked from kristapsdz/lowdown
-
Notifications
You must be signed in to change notification settings - Fork 0
/
extern.h
66 lines (57 loc) · 2.85 KB
/
extern.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/* $Id$ */
/*
* Copyright (c) 2016--2020 Kristaps Dzonsons <[email protected]>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef EXTERN_H
#define EXTERN_H
void *xmalloc(size_t) __attribute__((malloc));
void *xcalloc(size_t, size_t) __attribute__((malloc));
void *xrealloc(void *, size_t);
void *xreallocarray(void *, size_t, size_t);
void *xrecallocarray(void *, size_t, size_t, size_t);
char *xstrndup(const char *, size_t);
char *xstrdup(const char *);
void smarty(struct lowdown_node *, size_t, enum lowdown_type);
int32_t entity_find_iso(const struct lowdown_buf *);
const char *entity_find_tex(const struct lowdown_buf *, unsigned char *);
#define TEX_ENT_MATH 0x01
#define TEX_ENT_ASCII 0x02
int hbuf_eq(const struct lowdown_buf *, const struct lowdown_buf *);
int hbuf_streq(const struct lowdown_buf *, const char *);
int hbuf_strprefix(const struct lowdown_buf *, const char *);
void hbuf_free(struct lowdown_buf *);
void hbuf_grow(struct lowdown_buf *, size_t);
struct lowdown_buf *hbuf_clone(const struct lowdown_buf *, struct lowdown_buf *);
struct lowdown_buf *hbuf_new(size_t) __attribute__((malloc));
void hbuf_printf(struct lowdown_buf *, const char *, ...)
__attribute__((format (printf, 2, 3)));
void hbuf_put(struct lowdown_buf *, const char *, size_t);
void hbuf_putb(struct lowdown_buf *, const struct lowdown_buf *);
void hbuf_putc(struct lowdown_buf *, char);
int hbuf_putf(struct lowdown_buf *, FILE *);
void hbuf_puts(struct lowdown_buf *, const char *);
void hbuf_truncate(struct lowdown_buf *);
#define HBUF_PUTSL(output, literal) \
hbuf_put(output, literal, sizeof(literal) - 1)
size_t halink_email(size_t *, struct lowdown_buf *, char *, size_t, size_t);
size_t halink_url(size_t *, struct lowdown_buf *, char *, size_t, size_t);
size_t halink_www(size_t *, struct lowdown_buf *, char *, size_t, size_t);
void hesc_attr(struct lowdown_buf *, const char *, size_t);
void hesc_href(struct lowdown_buf *, const char *, size_t);
void hesc_html(struct lowdown_buf *, const char *, size_t, int, int, int);
char *rcsdate2str(const char *);
char *date2str(const char *);
char *rcsauthor2str(const char *);
#endif /* !EXTERN_H */