ref: 07ee7c9d60bdbcf87390ca0fbf057c042bb50f9e
parent: 2b98fd286cbe6768ce9877314cba9fc4ffa11259
author: Henrik Gramner <[email protected]>
date: Tue Jun 9 14:10:57 EDT 2020
Avoid compiling logging functions when logging is disabled
--- a/src/log.c
+++ b/src/log.c
@@ -36,6 +36,7 @@
#include "src/internal.h"
#include "src/log.h"
+#if CONFIG_LOG
COLD void dav1d_log_default_callback(void *const cookie,
const char *const format, va_list ap)
{
@@ -42,7 +43,6 @@
vfprintf(stderr, format, ap);
}
-#if CONFIG_LOG
COLD void dav1d_log(Dav1dContext *const c, const char *const format, ...) {
validate_input(c != NULL);
--- a/src/log.h
+++ b/src/log.h
@@ -35,12 +35,12 @@
#include "common/attributes.h"
-void dav1d_log_default_callback(void *cookie, const char *format, va_list ap);
-
#if CONFIG_LOG
#define dav1d_log dav1d_log
+void dav1d_log_default_callback(void *cookie, const char *format, va_list ap);
void dav1d_log(Dav1dContext *c, const char *format, ...) ATTR_FORMAT_PRINTF(2, 3);
#else
+#define dav1d_log_default_callback NULL
#define dav1d_log(...) do { } while(0)
#endif