summaryrefslogtreecommitdiff
path: root/lib/trim.c
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2008-05-19 18:10:38 +0200
committerJim Meyering <meyering@redhat.com>2008-05-19 18:10:38 +0200
commitcfc551f783f5bde5457a350fcc99bfc64857573d (patch)
tree454a14b2b91b2d9c1eef542d5ed71bccaf1cd7ed /lib/trim.c
parentc35f42a7b630ad7a64ca612628260b3ea62f8688 (diff)
downloadgnulib-cfc551f783f5bde5457a350fcc99bfc64857573d.tar.gz
avoid a warning from gcc
* lib/trim.c (IF_LINT): Define. (trim2): Use it to void a "may be used uninitialized" warning.
Diffstat (limited to 'lib/trim.c')
-rw-r--r--lib/trim.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/trim.c b/lib/trim.c
index 3813ca88ab..3802301df4 100644
--- a/lib/trim.c
+++ b/lib/trim.c
@@ -33,6 +33,13 @@
#include "xalloc.h"
+/* Use this to suppress gcc's `...may be used before initialized' warnings. */
+#ifdef lint
+# define IF_LINT(Code) Code
+#else
+# define IF_LINT(Code) /* empty */
+#endif
+
char *
trim2(const char *s, int how)
{
@@ -63,7 +70,7 @@ trim2(const char *s, int how)
if (how != TRIM_LEADING)
{
int state = 0;
- char *r; /* used only while state = 2 */
+ char *r IF_LINT (= NULL); /* used only while state = 2 */
mbi_init (i, d, strlen (d));