Skip to content

Commit

Permalink
perf: avoid gumbo_debug function calls when GUMBO_DEBUG isn't def'd
Browse files Browse the repository at this point in the history
Part of #2722

Co-authored-by: Stephen Checkoway <s@pahtak.org>
  • Loading branch information
flavorjones and stevecheckoway committed Dec 11, 2022
1 parent 7b3f40a commit 61557ea
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 0 additions & 2 deletions gumbo-parser/src/util.c
Expand Up @@ -63,6 +63,4 @@ void gumbo_debug(const char* format, ...) {
va_end(args);
fflush(stdout);
}
#else
void gumbo_debug(const char* UNUSED_ARG(format), ...) {}
#endif
4 changes: 4 additions & 0 deletions gumbo-parser/src/util.h
Expand Up @@ -21,7 +21,11 @@ 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
}
Expand Down

0 comments on commit 61557ea

Please sign in to comment.