From: Bruno Haible Date: Thu, 18 Oct 2007 10:57:57 +0000 (+0200) Subject: Fix various issues with the 'trim' module. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cb22a9e1bb8d6f16cc03a879d5671a7dd06f7314;p=pspp Fix various issues with the 'trim' module. --- diff --git a/ChangeLog b/ChangeLog index afe0e95dd9..82d96c9cb1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2007-10-18 Colin Watson (tiny change) + Bruno Haible + + * lib/trim.c: Include config.h unconditionally. Include trim.h always. + Include ctype.h always. Include stdlib.h, not mbuiter.h, for MB_CUR_MAX. + * modules/trim (Depends-on): Add mbchar. + (configure.ac): Add gl_FUNC_MBRTOWC. + (Makefile.am): Augment lib_SOURCES. + 2007-10-17 Paul Eggert Modify glob.c to use fstatat and dirfd, to simplify it. diff --git a/lib/trim.c b/lib/trim.c index b9175490af..f687f1858c 100644 --- a/lib/trim.c +++ b/lib/trim.c @@ -1,5 +1,5 @@ /* Removes leading and/or trailing whitespaces - Copyright (C) 2006 Free Software Foundation, Inc. + Copyright (C) 2006-2007 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,21 +16,21 @@ /* Written by Davide Angelocola */ -#ifdef HAVE_CONFIG_H -# include -#endif +#include + +/* Specification. */ +#include "trim.h" + +#include #if HAVE_MBRTOWC # include +# include # include "mbchar.h" # include "mbiter.h" -# include "mbuiter.h" /* FIXME: for MB_CUR_MAX */ -#else -# include #endif #include "xalloc.h" -#include "trim.h" char * trim2(const char *s, int how) @@ -62,7 +62,7 @@ trim2(const char *s, int how) if (how != TRIM_LEADING) { int state = 0; - char *r; + char *r; /* used only while state = 2 */ mbi_init (i, d, strlen (d)); diff --git a/modules/trim b/modules/trim index 27cdefc363..70286f8cd5 100644 --- a/modules/trim +++ b/modules/trim @@ -2,16 +2,19 @@ Description: trim() removes leading and/or trailing whitespaces Files: -lib/trim.c lib/trim.h +lib/trim.c Depends-on: xalloc +mbchar mbiter configure.ac: +gl_FUNC_MBRTOWC Makefile.am: +lib_SOURCES += trim.c Include: #include "trim.h"