/src/nokogiri/gumbo-parser/src/util.h
Line | Count | Source |
1 | | #ifndef GUMBO_UTIL_H_ |
2 | | #define GUMBO_UTIL_H_ |
3 | | |
4 | | #include <stdbool.h> |
5 | | #include <stddef.h> |
6 | | #include "macros.h" |
7 | | |
8 | | #ifdef __cplusplus |
9 | | extern "C" { |
10 | | #endif |
11 | | |
12 | | // Utility function for allocating & copying a null-terminated string into a |
13 | | // freshly-allocated buffer. This is necessary for proper memory management; we |
14 | | // have the convention that all const char* in parse tree structures are |
15 | | // freshly-allocated, so if we didn't copy, we'd try to delete a literal string |
16 | | // when the parse tree is destroyed. |
17 | | char* gumbo_strdup(const char* str) XMALLOC NONNULL_ARGS; |
18 | | |
19 | | void* gumbo_alloc(size_t size) XMALLOC; |
20 | | void* gumbo_realloc(void* ptr, size_t size) RETURNS_NONNULL; |
21 | | void gumbo_free(void* ptr); |
22 | | |
23 | | // Debug wrapper for printf |
24 | | #ifdef GUMBO_DEBUG |
25 | | void gumbo_debug(const char* format, ...) PRINTF(1); |
26 | | #else |
27 | 55.7M | static inline void PRINTF(1) gumbo_debug(const char* UNUSED_ARG(format), ...) {};Unexecuted instantiation: error.c:gumbo_debug Line | Count | Source | 27 | 37.6M | static inline void PRINTF(1) gumbo_debug(const char* UNUSED_ARG(format), ...) {}; |
Unexecuted instantiation: string_buffer.c:gumbo_debug Unexecuted instantiation: tag.c:gumbo_debug Unexecuted instantiation: token_buffer.c:gumbo_debug Line | Count | Source | 27 | 18.1M | static inline void PRINTF(1) gumbo_debug(const char* UNUSED_ARG(format), ...) {}; |
Unexecuted instantiation: util.c:gumbo_debug Unexecuted instantiation: vector.c:gumbo_debug Unexecuted instantiation: attribute.c:gumbo_debug |
28 | | #endif |
29 | | |
30 | | #ifdef __cplusplus |
31 | | } |
32 | | #endif |
33 | | |
34 | | #endif // GUMBO_UTIL_H_ |