summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2011-04-03 22:23:14 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2011-04-03 22:23:14 +0000
commitff6000745886cb085ca80e42498020497bc7f95f (patch)
tree41439653b4e24185009d6c48c9f8b37b4c93894f /utils
parent2ca6e9a3e6bd7450cd1fb80db3a777956c804e11 (diff)
downloadnetsurf-ff6000745886cb085ca80e42498020497bc7f95f.tar.gz
netsurf-ff6000745886cb085ca80e42498020497bc7f95f.tar.bz2
Fix build with NDEBUG defined
svn path=/trunk/netsurf/; revision=12154
Diffstat (limited to 'utils')
-rw-r--r--utils/log.c13
-rw-r--r--utils/log.h9
-rw-r--r--utils/utils.c3
3 files changed, 13 insertions, 12 deletions
diff --git a/utils/log.c b/utils/log.c
index 31ca89d13..0f9290bf7 100644
--- a/utils/log.c
+++ b/utils/log.c
@@ -28,9 +28,6 @@
#include "utils/utils.h"
#include "utils/log.h"
-static struct timeval start_tv;
-static char buff[32];
-
nserror nslog_init(nslog_ensure_t *ensure, int *pargc, char **argv)
{
nserror ret = NSERROR_OK;
@@ -59,9 +56,13 @@ nserror nslog_init(nslog_ensure_t *ensure, int *pargc, char **argv)
return ret;
}
+#ifndef NDEBUG
const char *nslog_gettime(void)
{
+ static struct timeval start_tv;
+ static char buff[32];
+
struct timeval tv;
struct timeval now_tv;
@@ -72,7 +73,9 @@ const char *nslog_gettime(void)
timeval_subtract(&tv, &now_tv, &start_tv);
- snprintf(buff, sizeof(buff),"(%ld.%ld)", (long)tv.tv_sec, (long)tv.tv_usec);
+ snprintf(buff, sizeof(buff),"(%ld.%ld)",
+ (long)tv.tv_sec, (long)tv.tv_usec);
+
return buff;
}
@@ -89,3 +92,5 @@ void nslog_log(const char *format, ...)
}
}
+#endif
+
diff --git a/utils/log.h b/utils/log.h
index 84a211d95..b49f439db 100644
--- a/utils/log.h
+++ b/utils/log.h
@@ -24,11 +24,6 @@
#include "desktop/netsurf.h"
#include "utils/errors.h"
-#ifdef NDEBUG
-# define LOG(x) ((void) 0)
-#else
-
-
/**
* Ensures the FILE handle is available to write logging to.
*
@@ -45,6 +40,10 @@ typedef bool(nslog_ensure_t)(FILE *fptr);
*/
extern nserror nslog_init(nslog_ensure_t *ensure, int *pargc, char **argv);
+#ifdef NDEBUG
+# define LOG(x) ((void) 0)
+#else
+
/**
* Obtain a formatted string suitable for prepending to a log message
*
diff --git a/utils/utils.c b/utils/utils.c
index 66c020f1d..f632af9e4 100644
--- a/utils/utils.c
+++ b/utils/utils.c
@@ -33,9 +33,6 @@
#include <time.h>
#include "utils/config.h"
-#define NDEBUG
-#include "utils/log.h"
-#undef NDEBUG
#include "utils/messages.h"
#include "utils/utf8.h"
#include "utils/utils.h"