Mercurial > hg > octave-lyh > gnulib-hg
changeset 10089:9b4c9ada2723
avoid a warning from gcc
* lib/trim.c (IF_LINT): Define.
(trim2): Use it to void a "may be used uninitialized" warning.
author | Jim Meyering <meyering@redhat.com> |
---|---|
date | Mon, 19 May 2008 18:10:38 +0200 |
parents | 03b96a68253f |
children | 8ea8f3be5116 |
files | ChangeLog lib/trim.c |
diffstat | 2 files changed, 12 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2008-05-19 Jim Meyering <meyering@redhat.com> + avoid a warning from gcc + * lib/trim.c (IF_LINT): Define. + (trim2): Use it to void a "may be used uninitialized" warning. + Fix doc typo. * doc/glibc-functions/getpass.texi (getpass): s/PATH_MAX/PASS_MAX/.
--- 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 @@ 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));