From be0081b8acd1dc64b9ad44595b19c5fb68baf5c4 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 12 Feb 2002 12:35:06 +0000 Subject: Use bool where appropriate. --- lib/ChangeLog | 11 +++++++++++ lib/c-ctype.c | 28 ++++++++++++++-------------- lib/c-ctype.h | 32 +++++++++++++++++--------------- lib/tmpdir.c | 9 +++++---- lib/tmpdir.h | 5 +++-- lib/vasprintf.c | 8 ++++---- src/ChangeLog | 5 +++++ src/message.c | 2 +- src/message.h | 2 +- 9 files changed, 61 insertions(+), 41 deletions(-) diff --git a/lib/ChangeLog b/lib/ChangeLog index 6977e75..a19f5a7 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,14 @@ +2002-02-09 Bruno Haible + + * c-ctype.h (c_is*): Change return type to bool. + * c-ctype.c (c_is*): Likewise. + + * tmpdir.h (path_search): Change last argument's type to bool. + * tmpdir.c (path_search): Likewise. + (direxists): Change return type to bool. + + * vasprintf.c (int_vasprintf): Change total_width to size_t. + 2002-02-11 Bruno Haible * config.charset: Add support for NetBSD. diff --git a/lib/c-ctype.c b/lib/c-ctype.c index f1c5a0e..f918dc6 100644 --- a/lib/c-ctype.c +++ b/lib/c-ctype.c @@ -1,6 +1,6 @@ /* Character handling in C locale. - Copyright 2000, 2001 Free Software Foundation, Inc. + Copyright 2000-2002 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 @@ -37,14 +37,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* The function isascii is not locale dependent. Its use in EBCDIC is questionable. */ -int +bool c_isascii (c) int c; { return ((c & ~0x7f) == 0); } -int +bool c_isalnum (c) int c; { @@ -75,7 +75,7 @@ c_isalnum (c) #endif } -int +bool c_isalpha (c) int c; { @@ -101,14 +101,14 @@ c_isalpha (c) #endif } -int +bool c_isblank (c) int c; { return (c == ' ' || c == '\t'); } -int +bool c_iscntrl (c) int c; { @@ -143,7 +143,7 @@ c_iscntrl (c) #endif } -int +bool c_isdigit (c) int c; { @@ -161,7 +161,7 @@ c_isdigit (c) #endif } -int +bool c_islower (c) int c; { @@ -182,7 +182,7 @@ c_islower (c) #endif } -int +bool c_isgraph (c) int c; { @@ -217,7 +217,7 @@ c_isgraph (c) #endif } -int +bool c_isprint (c) int c; { @@ -252,7 +252,7 @@ c_isprint (c) #endif } -int +bool c_ispunct (c) int c; { @@ -278,7 +278,7 @@ c_ispunct (c) #endif } -int +bool c_isspace (c) int c; { @@ -286,7 +286,7 @@ c_isspace (c) || c == '\n' || c == '\v' || c == '\f' || c == '\r'); } -int +bool c_isupper (c) int c; { @@ -307,7 +307,7 @@ c_isupper (c) #endif } -int +bool c_isxdigit (c) int c; { diff --git a/lib/c-ctype.h b/lib/c-ctype.h index 64222c5..929b14e 100644 --- a/lib/c-ctype.h +++ b/lib/c-ctype.h @@ -5,7 +5,7 @@ functions' behaviour depends on the current locale set via setlocale. - Copyright (C) 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 2000-2002 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 @@ -32,6 +32,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ # endif #endif +#include + /* Check whether the ASCII optimizations apply. */ @@ -98,20 +100,20 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Function declarations. */ -extern int c_isascii PARAMS ((int c)); /* not locale dependent */ - -extern int c_isalnum PARAMS ((int c)); -extern int c_isalpha PARAMS ((int c)); -extern int c_isblank PARAMS ((int c)); -extern int c_iscntrl PARAMS ((int c)); -extern int c_isdigit PARAMS ((int c)); -extern int c_islower PARAMS ((int c)); -extern int c_isgraph PARAMS ((int c)); -extern int c_isprint PARAMS ((int c)); -extern int c_ispunct PARAMS ((int c)); -extern int c_isspace PARAMS ((int c)); -extern int c_isupper PARAMS ((int c)); -extern int c_isxdigit PARAMS ((int c)); +extern bool c_isascii PARAMS ((int c)); /* not locale dependent */ + +extern bool c_isalnum PARAMS ((int c)); +extern bool c_isalpha PARAMS ((int c)); +extern bool c_isblank PARAMS ((int c)); +extern bool c_iscntrl PARAMS ((int c)); +extern bool c_isdigit PARAMS ((int c)); +extern bool c_islower PARAMS ((int c)); +extern bool c_isgraph PARAMS ((int c)); +extern bool c_isprint PARAMS ((int c)); +extern bool c_ispunct PARAMS ((int c)); +extern bool c_isspace PARAMS ((int c)); +extern bool c_isupper PARAMS ((int c)); +extern bool c_isxdigit PARAMS ((int c)); extern int c_tolower PARAMS ((int c)); extern int c_toupper PARAMS ((int c)); diff --git a/lib/tmpdir.c b/lib/tmpdir.c index 37f4f6a..11b6294 100644 --- a/lib/tmpdir.c +++ b/lib/tmpdir.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1999, 2001 Free Software Foundation, Inc. +/* Copyright (C) 1999, 2001-2002 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -25,6 +25,7 @@ /* Specification. */ #include "tmpdir.h" +#include #include #include @@ -78,11 +79,11 @@ /* Prototypes for local functions. Needed to ensure compiler checking of function argument counts despite of K&R C function definition syntax. */ -static int direxists PARAMS ((const char *dir)); +static bool direxists PARAMS ((const char *dir)); /* Return nonzero if DIR is an existent directory. */ -static int +static bool direxists (dir) const char *dir; { @@ -102,7 +103,7 @@ path_search (tmpl, tmpl_len, dir, pfx, try_tmpdir) size_t tmpl_len; const char *dir; const char *pfx; - int try_tmpdir; + bool try_tmpdir; { const char *d; size_t dlen, plen; diff --git a/lib/tmpdir.h b/lib/tmpdir.h index 2a8a37d..8eaed9e 100644 --- a/lib/tmpdir.h +++ b/lib/tmpdir.h @@ -1,5 +1,5 @@ /* Determine a temporary directory. - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 2001-2002 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 @@ -23,6 +23,7 @@ # endif #endif +#include #include /* Path search algorithm, for tmpnam, tmpfile, etc. If DIR is @@ -31,4 +32,4 @@ for use with mk[s]temp. Will fail (-1) if DIR is non-null and doesn't exist, none of the searched dirs exists, or there's not enough space in TMPL. */ -extern int path_search PARAMS ((char *tmpl, size_t tmpl_len, const char *dir, const char *pfx, int try_tmpdir)); +extern int path_search PARAMS ((char *tmpl, size_t tmpl_len, const char *dir, const char *pfx, bool try_tmpdir)); diff --git a/lib/vasprintf.c b/lib/vasprintf.c index 1c2a085..c723ed4 100644 --- a/lib/vasprintf.c +++ b/lib/vasprintf.c @@ -1,6 +1,6 @@ /* Like vsprintf but provides a pointer to malloc'd storage, which must be freed by the caller. - Copyright (C) 1994, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 1994, 1998, 1999, 2000-2002 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 @@ -33,7 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #ifdef TEST -int global_total_width; +size_t global_total_width; #endif static int @@ -45,7 +45,7 @@ int_vasprintf (result, format, args) const char *p = format; /* Add one to make sure that it is never zero, which might cause malloc to return NULL. */ - int total_width = strlen (format) + 1; + size_t total_width = strlen (format) + 1; va_list ap; memcpy (&ap, args, sizeof (va_list)); @@ -191,7 +191,7 @@ checkit printf ("PASS: "); else printf ("FAIL: "); - printf ("%d %s\n", global_total_width, result); + printf ("%lu %s\n", (unsigned long) global_total_width, result); } int diff --git a/src/ChangeLog b/src/ChangeLog index dea45cd..6cda5b4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2002-02-09 Bruno Haible + + * message.h (possible_format_p): Change return type to bool. + * message.c (possible_format_p): Likewise. + 2002-01-14 Bruno Haible * x-glade.h: New file. diff --git a/src/message.c b/src/message.c index 84ac2d0..bbfb002 100644 --- a/src/message.c +++ b/src/message.c @@ -67,7 +67,7 @@ const char *const format_language_pretty[NFORMATS] = }; -int +bool possible_format_p (is_format) enum is_format is_format; { diff --git a/src/message.h b/src/message.h index aad981b..74fa4a7 100644 --- a/src/message.h +++ b/src/message.h @@ -59,7 +59,7 @@ enum is_format impossible }; -extern int +extern bool possible_format_p PARAMS ((enum is_format)); -- cgit v1.1