Remove K&R cruft.
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 12 Sep 2003 18:24:51 +0000 (18:24 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 12 Sep 2003 18:24:51 +0000 (18:24 +0000)
22 files changed:
lib/progreloc.c
lib/setenv.c
lib/stpncpy.c
lib/strdup.c
lib/strtod.c
lib/strtoimax.c
lib/strtol.c
lib/tempname.c
lib/userspec.c
lib/xgethostname.c
lib/xmalloc.c
lib/xstrtod.c
lib/xstrtol.c
m4/mkstemp.m4
m4/strdup.m4
m4/strtod.m4
m4/strtoimax.m4
m4/strtol.m4
m4/userspec.m4
m4/xalloc.m4
m4/xstrtod.m4
m4/xstrtol.m4

index cda55a76e91886c55507c9ec051656bd6ccf451c..13ecb436e4f294cefc7159218b328a63038b3376 100644 (file)
@@ -285,7 +285,7 @@ set_program_name_and_installdir (const char *argv0,
 /* Return the full pathname of the current executable, based on the earlier
    call to set_program_name_and_installdir.  Return NULL if unknown.  */
 char *
-get_full_program_name ()
+get_full_program_name (void)
 {
   return executable_fullname;
 }
index 0a28cb9fbf4870bc3db2d31db8462499d9168d05..f185e04db0d58ea48be6cc22d695e4b8b1fdd74f 100644 (file)
@@ -280,7 +280,7 @@ setenv (const char *name, const char *value, int replace)
    never made it.  Nevertheless the POSIX.9 standard (POSIX bindings
    for Fortran 77) requires this function.  */
 int
-clearenv ()
+clearenv (void)
 {
   LOCK;
 
index 243cbc7bb669076d82db9bde60ee7dcdd48453b4..c302e398d72fc0d407e709a72ac9bf302e715951 100644 (file)
 /* Specification.  */
 #include "stpncpy.h"
 
-#ifdef _LIBC
-# include <string.h>
-#else
-# include <sys/types.h>
-#endif
-
 #ifndef weak_alias
 # define __stpncpy stpncpy
 #endif
index 5aa09a652c3f2ab46218afb8b5a0708ad40f9fdd..28d2ba1aa9b2b7af7e5bc2130f169d0704f3ab79 100644 (file)
@@ -1,4 +1,6 @@
-/* Copyright (C) 1991, 1996, 1997, 1998, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1996, 1997, 1998, 2002, 2003 Free Software
+   Foundation, Inc.
+
    This file is part of the GNU C Library.
 
    This program is free software; you can redistribute it and/or modify
 #include <config.h>
 #endif
 
-#if defined _LIBC || defined  STDC_HEADERS
-# include <stdlib.h>
-# include <string.h>
-#else
-char *malloc ();
-char *memcpy ();
-#endif
+#include <stdlib.h>
+#include <string.h>
 
 #undef __strdup
 #undef strdup
index 10edb5cfe5a67c6c99a0d4b3aaa1a405072ba3e7..161f97a7b1894e074e6e7452a8332f63929ed9ea 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1997, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1992, 1997, 1999, 2003 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,22 +37,9 @@ extern int errno;
 
 #include <math.h>
 
-#if HAVE_FLOAT_H
-# include <float.h>
-#else
-# define DBL_MAX 1.7976931348623159e+308
-# define DBL_MIN 2.2250738585072010e-308
-#endif
-
-#if STDC_HEADERS
-# include <stdlib.h>
-# include <string.h>
-#else
-# define NULL 0
-# ifndef HUGE_VAL
-#  define HUGE_VAL HUGE
-# endif
-#endif
+#include <float.h>
+#include <stdlib.h>
+#include <string.h>
 
 /* Convert NPTR to a double.  If ENDPTR is not NULL, a pointer to the
    character after the last one used in the number is put in *ENDPTR.  */
index 555f2d5b5c43d35f35bd25f05fad259d02888401..4ce741cfdd3b948820f044d6817ef85c3e1e9982 100644 (file)
 # include <stdint.h>
 #endif
 
-#if HAVE_STDLIB_H
-# include <stdlib.h>
-#endif
+#include <stdlib.h>
 
 /* Verify a requirement at compile-time (unlike assert, which is runtime).  */
 #define verify(name, assertion) struct name { char a[(assertion) ? 1 : -1]; }
 
 #ifdef UNSIGNED
-# ifndef HAVE_DECL_STRTOUL
-"this configure-time declaration test was not run"
-# endif
-# if !HAVE_DECL_STRTOUL
-unsigned long strtoul (char const *, char **, int);
-# endif
 # ifndef HAVE_DECL_STRTOULL
 "this configure-time declaration test was not run"
 # endif
@@ -50,12 +42,6 @@ unsigned long long strtoull (char const *, char **, int);
 
 #else
 
-# ifndef HAVE_DECL_STRTOL
-"this configure-time declaration test was not run"
-# endif
-# if !HAVE_DECL_STRTOL
-long strtol (char const *, char **, int);
-# endif
 # ifndef HAVE_DECL_STRTOLL
 "this configure-time declaration test was not run"
 # endif
index 0c9c2767eab6ec158fc435e023e2bd8afd5001c8..d556e946305d4512bef41a8a45c3a1c56eb43df7 100644 (file)
@@ -1,5 +1,8 @@
 /* Convert string representation of a number into an integer value.
-   Copyright (C) 1991, 92, 94, 95, 96, 97, 98, 99 Free Software Foundation, Inc.
+
+   Copyright (C) 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2003
+   Free Software Foundation, Inc.
+
    NOTE: The canonical source of this file is maintained with the GNU C
    Library.  Bugs can be reported to bug-glibc@gnu.org.
 
@@ -23,8 +26,6 @@
 
 #ifdef _LIBC
 # define USE_NUMBER_GROUPING
-# define STDC_HEADERS
-# define HAVE_LIMITS_H
 #endif
 
 #include <ctype.h>
@@ -36,19 +37,10 @@ extern int errno;
 # define __set_errno(Val) errno = (Val)
 #endif
 
-#ifdef HAVE_LIMITS_H
-# include <limits.h>
-#endif
-
-#ifdef STDC_HEADERS
-# include <stddef.h>
-# include <stdlib.h>
-# include <string.h>
-#else
-# ifndef NULL
-#  define NULL 0
-# endif
-#endif
+#include <limits.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
 
 #ifdef USE_NUMBER_GROUPING
 # include "../locale/localeinfo.h"
@@ -164,13 +156,6 @@ extern int errno;
 # endif
 #else
 # define LONG long
-
-# ifndef ULONG_MAX
-#  define ULONG_MAX ((unsigned long) ~(unsigned long) 0)
-# endif
-# ifndef LONG_MAX
-#  define LONG_MAX ((long int) (ULONG_MAX >> 1))
-# endif
 # define STRTOL_LONG_MIN LONG_MIN
 # define STRTOL_LONG_MAX LONG_MAX
 # define STRTOL_ULONG_MAX ULONG_MAX
@@ -186,7 +171,7 @@ extern int errno;
 # define _NL_CURRENT(category, item) \
   (current->values[_NL_ITEM_INDEX (item)].string)
 # define LOCALE_PARAM , loc
-# define LOCALE_PARAM_DECL __locale_t loc;
+# define LOCALE_PARAM_DECL , __locale_t loc
 #else
 # define LOCALE_PARAM
 # define LOCALE_PARAM_DECL
@@ -230,15 +215,9 @@ extern int errno;
 # endif
 #endif
 
-/* For compilers which are ansi but don't define __STDC__, like SGI
-   Irix-4.0.5 cc, also check whether PROTOTYPES is defined. */
-#if defined (__STDC__) || defined (PROTOTYPES)
-# define INTERNAL(X) INTERNAL1(X)
-# define INTERNAL1(X) __##X##_internal
-# define WEAKNAME(X) WEAKNAME1(X)
-#else
-# define INTERNAL(X) __/**/X/**/_internal
-#endif
+#define INTERNAL(X) INTERNAL1(X)
+#define INTERNAL1(X) __##X##_internal
+#define WEAKNAME(X) WEAKNAME1(X)
 
 #ifdef USE_NUMBER_GROUPING
 /* This file defines a function to check for correct grouping.  */
@@ -255,12 +234,8 @@ extern int errno;
    one converted is stored in *ENDPTR.  */
 
 INT
-INTERNAL (strtol) (nptr, endptr, base, group LOCALE_PARAM)
-     const STRING_TYPE *nptr;
-     STRING_TYPE **endptr;
-     int base;
-     int group;
-     LOCALE_PARAM_DECL
+INTERNAL (strtol) (const STRING_TYPE *nptr, STRING_TYPE **endptr,
+                  int base, int group LOCALE_PARAM_DECL)
 {
   int negative;
   register unsigned LONG int cutoff;
@@ -445,28 +420,13 @@ noconv:
 \f
 /* External user entry point.  */
 
-#if _LIBC - 0 == 0
-# undef PARAMS
-# if defined (__STDC__) && __STDC__
-#  define PARAMS(Args) Args
-# else
-#  define PARAMS(Args) ()
-# endif
-
-/* Prototype.  */
-INT strtol PARAMS ((const STRING_TYPE *nptr, STRING_TYPE **endptr, int base));
-#endif
-
 
 INT
 #ifdef weak_function
 weak_function
 #endif
-strtol (nptr, endptr, base LOCALE_PARAM)
-     const STRING_TYPE *nptr;
-     STRING_TYPE **endptr;
-     int base;
-     LOCALE_PARAM_DECL
+strtol (const STRING_TYPE *nptr, STRING_TYPE **endptr,
+       int base LOCALE_PARAM_DECL)
 {
   return INTERNAL (strtol) (nptr, endptr, base, 0 LOCALE_PARAM);
 }
index 13a8204a4f48c2cc566821a2c9af0b1524f4eb3f..b3d0874ce9953cd37743813cfa0af298518b28a4 100644 (file)
 #endif
 
 #include <stddef.h>
-
-#if STDC_HEADERS || _LIBC
-# include <string.h>
-#endif
-
 #include <stdlib.h>
+#include <string.h>
 
 #if HAVE_FCNTL_H || _LIBC
 # include <fcntl.h>
index 19443ec912da8c0248cf98d2bd951e3d20ef33ed..6e58b486c7ed9e50ead5b9df56733945c85a9a93 100644 (file)
 #endif
 
 #include <limits.h>
-
-#if HAVE_STRING_H
-# include <string.h>
-#else
-# include <strings.h>
-# ifndef strchr
-#  define strchr index
-# endif
-#endif
-
-#if STDC_HEADERS
-# include <stdlib.h>
-#endif
+#include <stdlib.h>
+#include <string.h>
 
 #if HAVE_UNISTD_H
 # include <unistd.h>
index 5178784baca5bffa889d7db3078a65f0b3f405e0..c0939945bb635520b17e17faed19b0b05535ca03 100644 (file)
@@ -50,7 +50,7 @@ int gethostname ();
    If malloc fails, exit.
    Upon any other failure, return NULL.  */
 char *
-xgethostname ()
+xgethostname (void)
 {
   char *hostname;
   size_t size;
index ead50393d3485a251c8bb509987d894e7192f98f..82980ea58ce32e7ff50aa35b3a13f5e343bcba52 100644 (file)
 # include <config.h>
 #endif
 
-#include <sys/types.h>
-
-#if STDC_HEADERS
-# include <stdlib.h>
-#else
-void *calloc ();
-void *malloc ();
-void *realloc ();
-void free ();
-#endif
+#include "xalloc.h"
+
+#include <stdlib.h>
 
 #include "gettext.h"
 #define _(msgid) gettext (msgid)
@@ -38,7 +31,6 @@ void free ();
 
 #include "error.h"
 #include "exitfail.h"
-#include "xalloc.h"
 
 #ifndef EXIT_FAILURE
 # define EXIT_FAILURE 1
index 4b4c12afb79b42a15e877bf657be3d4f2d53a8b8..8450829bd2b949e532d2fa11a780a0b85f0fea17 100644 (file)
@@ -1,5 +1,5 @@
 /* xstrtod.c - error-checking interface to strtod
-   Copyright (C) 1996, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1999, 2000, 2003 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
 # include <config.h>
 #endif
 
-#ifdef STDC_HEADERS
-# include <stdlib.h>
-#else
-double strtod ();
-#endif
+#include "xstrtod.h"
 
 #include <errno.h>
-#include <stdio.h>
 #include <limits.h>
-#include "xstrtod.h"
+#include <stdio.h>
+#include <stdlib.h>
 
 /* Tell the compiler that non-default rounding modes are used.  */
 #if 199901 <= __STDC_VERSION__
@@ -43,10 +39,7 @@ double strtod ();
    non-zero and don't modify *RESULT upon any failure.  */
 
 int
-xstrtod (str, ptr, result)
-     const char *str;
-     const char **ptr;
-     double *result;
+xstrtod (char const *str, char const **ptr, double *result)
 {
   double val;
   char *terminator;
index 73d87bacb287e001e0dd1dc1b04c19a394a0ed15..4be09f1693f0bb13484bca140878d25c0d4bcab2 100644 (file)
    need stderr defined if assertion checking is enabled.  */
 #include <stdio.h>
 
-#if STDC_HEADERS
-# include <stdlib.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#else
-# include <strings.h>
-# ifndef strchr
-#  define strchr index
-# endif
-#endif
-
 #include <assert.h>
 #include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
 
 #include <errno.h>
 #ifndef errno
@@ -69,14 +58,6 @@ extern int errno;
 
 #include "xstrtol.h"
 
-#if !HAVE_DECL_STRTOL && !defined strtol
-long int strtol ();
-#endif
-
-#if !HAVE_DECL_STRTOUL && !defined strtoul
-unsigned long int strtoul ();
-#endif
-
 #if !HAVE_DECL_STRTOIMAX && !defined strtoimax
 intmax_t strtoimax ();
 #endif
@@ -266,7 +247,7 @@ __xstrtol (const char *s, char **ptr, int strtol_base,
 char *program_name;
 
 int
-main (int argc, char** argv)
+main (int argc, char **argv)
 {
   strtol_error s_err;
   int i;
index fd182935d40df76c3514bd88c9f51551b3465fd0..3d379fd2bf157eb26acb69ac72bcfa872f2df300 100644 (file)
@@ -57,7 +57,6 @@ AC_DEFUN([gl_PREREQ_MKSTEMP],
 # Prerequisites of lib/tempname.c.
 AC_DEFUN([jm_PREREQ_TEMPNAME],
 [
-  AC_REQUIRE([AC_HEADER_STDC])
   AC_REQUIRE([AC_HEADER_STAT])
   AC_CHECK_HEADERS_ONCE(fcntl.h sys/time.h unistd.h)
   AC_CHECK_HEADERS(stdint.h)
index 08087063d82dd84d931a8007c6b257aa983d85cf..effeb60eacb254c76f0f8a6ce87b55750ff32d22 100644 (file)
@@ -1,5 +1,5 @@
-# strdup.m4 serial 1
-dnl Copyright (C) 2002 Free Software Foundation, Inc.
+# strdup.m4 serial 2
+dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc.
 dnl This file is free software, distributed under the terms of the GNU
 dnl General Public License.  As a special exception to the GNU General
 dnl Public License, this file may be distributed as part of a program
@@ -16,7 +16,6 @@ AC_DEFUN([gl_FUNC_STRDUP],
 
 # Prerequisites of lib/strdup.c.
 AC_DEFUN([gl_PREREQ_STRDUP], [
-  AC_REQUIRE([AC_HEADER_STDC])
   :
 ])
 
index 809a83fa808ad36d82beeebdc4fd5dbd2f8af793..fb742f7d58957f67472866de2e2f45dfcdfcd208 100644 (file)
@@ -1,4 +1,4 @@
-# strtod.m4 serial 2
+# strtod.m4 serial 3
 dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
 dnl This file is free software, distributed under the terms of the GNU
 dnl General Public License.  As a special exception to the GNU General
@@ -20,6 +20,5 @@ AC_DEFUN([gl_FUNC_STRTOD],
 # The need for pow() is already handled by AC_FUNC_STRTOD.
 AC_DEFUN([gl_PREREQ_STRTOD], [
   AC_REQUIRE([AC_HEADER_STDC])
-  AC_CHECK_HEADERS(float.h)
   AC_CHECK_FUNCS_ONCE(isascii)
 ])
index 7a338f2aa89c376c4326d1442b9a2c804f3bae16..2cc1776d72017873f161fd96b70a0a70c0e8fbfe 100644 (file)
@@ -1,4 +1,4 @@
-# strtoimax.m4 serial 2
+# strtoimax.m4 serial 3
 dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
 dnl This file is free software, distributed under the terms of the GNU
 dnl General Public License.  As a special exception to the GNU General
@@ -32,8 +32,6 @@ AC_DEFUN([gl_FUNC_STRTOIMAX],
 # Prerequisites of lib/strtoimax.c.
 AC_DEFUN([gl_PREREQ_STRTOIMAX], [
   jm_AC_TYPE_INTMAX_T
-  AC_CHECK_HEADERS_ONCE(stdlib.h)
-  AC_CHECK_DECLS_ONCE(strtol)
   AC_CHECK_DECLS(strtoll)
   AC_REQUIRE([jm_AC_TYPE_LONG_LONG])
 ])
index 59a74f655d6c4cad59d09606dfe743311ad2abc5..7740eccdabd86985da13a646f00d8e26fb502746 100644 (file)
@@ -1,5 +1,5 @@
-# strtol.m4 serial 1
-dnl Copyright (C) 2002 Free Software Foundation, Inc.
+# strtol.m4 serial 2
+dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc.
 dnl This file is free software, distributed under the terms of the GNU
 dnl General Public License.  As a special exception to the GNU General
 dnl Public License, this file may be distributed as part of a program
@@ -17,6 +17,5 @@ AC_DEFUN([gl_FUNC_STRTOL],
 # Prerequisites of lib/strtol.c.
 AC_DEFUN([gl_PREREQ_STRTOL], [
   AC_REQUIRE([AC_HEADER_STDC])
-  AC_CHECK_HEADERS_ONCE(limits.h)
   AC_CHECK_FUNCS_ONCE(isascii)
 ])
index 862c871709470bfb100b86144a2ce621ae5a1fe7..df78b83cc324d6d783d6eec58c32d1144594f0b5 100644 (file)
@@ -1,4 +1,4 @@
-# userspec.m4 serial 2
+# userspec.m4 serial 3
 dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc.
 dnl This file is free software, distributed under the terms of the GNU
 dnl General Public License.  As a special exception to the GNU General
@@ -9,7 +9,6 @@ dnl the same distribution terms as the rest of that program.
 AC_DEFUN([gl_USERSPEC],
 [
   dnl Prerequisites of lib/userspec.c.
-  AC_REQUIRE([AC_HEADER_STDC])
   AC_REQUIRE([AC_FUNC_ALLOCA])
-  AC_CHECK_HEADERS_ONCE(string.h sys/param.h unistd.h)
+  AC_CHECK_HEADERS_ONCE(sys/param.h unistd.h)
 ])
index 5dcb730539b7ddfe2c7f8ba4af12a9aa44c85d29..9f6e87d03cb73668c100977127d0006a9e6ffbcf 100644 (file)
@@ -1,4 +1,4 @@
-# xalloc.m4 serial 2
+# xalloc.m4 serial 3
 dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
 dnl This file is free software, distributed under the terms of the GNU
 dnl General Public License.  As a special exception to the GNU General
@@ -14,7 +14,6 @@ AC_DEFUN([gl_XALLOC],
 
 # Prerequisites of lib/xmalloc.c.
 AC_DEFUN([gl_PREREQ_XMALLOC], [
-  AC_REQUIRE([AC_HEADER_STDC])
   AC_REQUIRE([jm_FUNC_MALLOC])
   AC_REQUIRE([jm_FUNC_REALLOC])
 ])
index 4056d8cf0e05fec7c3a3e8e755af03b7f5c1cfa4..93528c2f5197555e67d0a3d24ce50c4b3ef38190 100644 (file)
@@ -1,5 +1,5 @@
-# xstrtod.m4 serial 1
-dnl Copyright (C) 2002 Free Software Foundation, Inc.
+# xstrtod.m4 serial 2
+dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc.
 dnl This file is free software, distributed under the terms of the GNU
 dnl General Public License.  As a special exception to the GNU General
 dnl Public License, this file may be distributed as part of a program
@@ -9,5 +9,5 @@ dnl the same distribution terms as the rest of that program.
 # Prerequisites of lib/xstrtod.c.
 AC_DEFUN([gl_XSTRTOD],
 [
-  AC_REQUIRE([AC_HEADER_STDC])
+  :
 ])
index 86d14b68c009e68054ba9caa03b61d3e515a75c9..a21ab2b05aadc33951d20e16972305299c7439f1 100644 (file)
@@ -1,4 +1,4 @@
-# xstrtol.m4 serial 2
+# xstrtol.m4 serial 3
 dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc.
 dnl This file is free software, distributed under the terms of the GNU
 dnl General Public License.  As a special exception to the GNU General
@@ -24,9 +24,7 @@ AC_DEFUN([gl_PREREQ_XSTRTOL],
 [
   AC_REQUIRE([gl_PREREQ_XSTRTOL_H])
   AC_REQUIRE([AC_HEADER_STDC])
-  AC_CHECK_HEADERS_ONCE(string.h)
   AC_CHECK_FUNCS_ONCE(isascii)
-  AC_CHECK_DECLS_ONCE(strtol strtoul)
   AC_CHECK_DECLS([strtoimax, strtoumax])
 ])