Skip to content

Commit 61557ea

Browse files
perf: avoid gumbo_debug function calls when GUMBO_DEBUG isn't def'd
Part of #2722 Co-authored-by: Stephen Checkoway <s@pahtak.org>
1 parent 7b3f40a commit 61557ea

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

gumbo-parser/src/util.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,4 @@ void gumbo_debug(const char* format, ...) {
6363
va_end(args);
6464
fflush(stdout);
6565
}
66-
#else
67-
void gumbo_debug(const char* UNUSED_ARG(format), ...) {}
6866
#endif

gumbo-parser/src/util.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ void* gumbo_realloc(void* ptr, size_t size) RETURNS_NONNULL;
2121
void gumbo_free(void* ptr);
2222

2323
// Debug wrapper for printf
24+
#ifdef GUMBO_DEBUG
2425
void gumbo_debug(const char* format, ...) PRINTF(1);
26+
#else
27+
static inline void PRINTF(1) gumbo_debug(const char* UNUSED_ARG(format), ...) {};
28+
#endif
2529

2630
#ifdef __cplusplus
2731
}

0 commit comments

Comments
 (0)