summaryrefslogtreecommitdiff
path: root/src/numfmt.c
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2013-02-14 02:32:22 +0000
committerPádraig Brady <P@draigBrady.com>2013-02-14 03:24:46 +0000
commit302564444383169087fbbec36983789abbac9aa5 (patch)
tree23b4a7b6cd908628250e985fd275da8d2d3a83f2 /src/numfmt.c
parentfff11aca4faaee33a032cb11d7453c6e938b71b7 (diff)
downloadcoreutils-302564444383169087fbbec36983789abbac9aa5.tar.xz
build: avoid link failure in devmsg() on older linkers
On linkers that don't remove unused functions, there will be a reference to a missing dev_debug symbol in the devmsg() function. So for now ... * src/system.h: ... move devmsg() from here ... * src/numfmt.c: ... to here, and document future cleanup. * src/factor.c: Likewise.
Diffstat (limited to 'src/numfmt.c')
-rw-r--r--src/numfmt.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/numfmt.c b/src/numfmt.c
index 9a321d697..8c21c2b3a 100644
--- a/src/numfmt.c
+++ b/src/numfmt.c
@@ -190,13 +190,28 @@ static uintmax_t header = 0;
error (similar to sort's debug). */
static bool debug;
-/* debugging for developers. Enables devmsg(). */
-bool dev_debug = false;
-
/* will be set according to the current locale. */
static const char *decimal_point;
static int decimal_point_length;
+/* debugging for developers. Enables devmsg(). */
+static bool dev_debug = false;
+
+/* Like error(0, 0, ...), but without an implicit newline.
+ Also a noop unless the global DEV_DEBUG is set.
+ TODO: Replace with variadic macro in system.h or
+ move to a separate module. */
+static inline void
+devmsg (char const *fmt, ...)
+{
+ if (dev_debug)
+ {
+ va_list ap;
+ va_start (ap, fmt);
+ vfprintf (stderr, fmt, ap);
+ va_end (ap);
+ }
+}
static inline int
default_scale_base (enum scale_type scale)