Sha256: 026c711d9585da380a2818a5c1c5ad474deaeb778d1a354b4ae8575891f2968e

Contents?: true

Size: 932 Bytes

Versions: 32

Compression:

Stored size: 932 Bytes

Contents

#ifndef GUMBO_UTIL_H_
#define GUMBO_UTIL_H_

#include <stdbool.h>
#include <stddef.h>
#include "macros.h"

#ifdef __cplusplus
extern "C" {
#endif

// Utility function for allocating & copying a null-terminated string into a
// freshly-allocated buffer. This is necessary for proper memory management; we
// have the convention that all const char* in parse tree structures are
// freshly-allocated, so if we didn't copy, we'd try to delete a literal string
// when the parse tree is destroyed.
char* gumbo_strdup(const char* str) XMALLOC NONNULL_ARGS;

void* gumbo_alloc(size_t size) XMALLOC;
void* gumbo_realloc(void* ptr, size_t size) RETURNS_NONNULL;
void gumbo_free(void* ptr);

// Debug wrapper for printf
#ifdef GUMBO_DEBUG
void gumbo_debug(const char* format, ...) PRINTF(1);
#else
static inline void PRINTF(1) gumbo_debug(const char* UNUSED_ARG(format), ...) {};
#endif

#ifdef __cplusplus
}
#endif

#endif // GUMBO_UTIL_H_

Version data entries

32 entries across 32 versions & 2 rubygems

Version Path
nokogiri-1.15.4 gumbo-parser/src/util.h
nokogiri-1.15.3 gumbo-parser/src/util.h
nokogiri-1.15.2 gumbo-parser/src/util.h
nokogiri-1.14.5 gumbo-parser/src/util.h
nokogiri-1.15.1 gumbo-parser/src/util.h
nokogiri-1.15.0 gumbo-parser/src/util.h
nokogiri-1.14.4 gumbo-parser/src/util.h
nokogiri-1.14.3 gumbo-parser/src/util.h
nokogiri-1.14.2 gumbo-parser/src/util.h
nokogiri-1.14.1 gumbo-parser/src/util.h
nokogiri-1.14.0 gumbo-parser/src/util.h
nokogiri-1.14.0.rc1 gumbo-parser/src/util.h