summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2003-09-12 18:24:51 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2003-09-12 18:24:51 +0000
commitfa9635f22ac175bace582885ca780d3eb511b578 (patch)
tree21fd7c8fa3aa44721a172d994602d2fb1304255f
parentad1676ccbe111c941bae095d7426e34a83c975f0 (diff)
downloadgnulib-fa9635f22ac175bace582885ca780d3eb511b578.tar.gz
Remove K&R cruft.
-rw-r--r--lib/progreloc.c2
-rw-r--r--lib/setenv.c2
-rw-r--r--lib/stpncpy.c6
-rw-r--r--lib/strdup.c13
-rw-r--r--lib/strtod.c21
-rw-r--r--lib/strtoimax.c16
-rw-r--r--lib/strtol.c72
-rw-r--r--lib/tempname.c6
-rw-r--r--lib/userspec.c15
-rw-r--r--lib/xgethostname.c2
-rw-r--r--lib/xmalloc.c14
-rw-r--r--lib/xstrtod.c17
-rw-r--r--lib/xstrtol.c25
-rw-r--r--m4/mkstemp.m41
-rw-r--r--m4/strdup.m45
-rw-r--r--m4/strtod.m43
-rw-r--r--m4/strtoimax.m44
-rw-r--r--m4/strtol.m45
-rw-r--r--m4/userspec.m45
-rw-r--r--m4/xalloc.m43
-rw-r--r--m4/xstrtod.m46
-rw-r--r--m4/xstrtol.m44
22 files changed, 56 insertions, 191 deletions
diff --git a/lib/progreloc.c b/lib/progreloc.c
index cda55a76e9..13ecb436e4 100644
--- a/lib/progreloc.c
+++ b/lib/progreloc.c
@@ -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;
}
diff --git a/lib/setenv.c b/lib/setenv.c
index 0a28cb9fbf..f185e04db0 100644
--- a/lib/setenv.c
+++ b/lib/setenv.c
@@ -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;
diff --git a/lib/stpncpy.c b/lib/stpncpy.c
index 243cbc7bb6..c302e398d7 100644
--- a/lib/stpncpy.c
+++ b/lib/stpncpy.c
@@ -27,12 +27,6 @@
/* Specification. */
#include "stpncpy.h"
-#ifdef _LIBC
-# include <string.h>
-#else
-# include <sys/types.h>
-#endif
-
#ifndef weak_alias
# define __stpncpy stpncpy
#endif
diff --git a/lib/strdup.c b/lib/strdup.c
index 5aa09a652c..28d2ba1aa9 100644
--- a/lib/strdup.c
+++ b/lib/strdup.c
@@ -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
@@ -19,13 +21,8 @@
#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
diff --git a/lib/strtod.c b/lib/strtod.c
index 10edb5cfe5..161f97a7b1 100644
--- a/lib/strtod.c
+++ b/lib/strtod.c
@@ -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. */
diff --git a/lib/strtoimax.c b/lib/strtoimax.c
index 555f2d5b5c..4ce741cfdd 100644
--- a/lib/strtoimax.c
+++ b/lib/strtoimax.c
@@ -27,20 +27,12 @@
# 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
diff --git a/lib/strtol.c b/lib/strtol.c
index 0c9c2767ea..d556e94630 100644
--- a/lib/strtol.c
+++ b/lib/strtol.c
@@ -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:
/* 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);
}
diff --git a/lib/tempname.c b/lib/tempname.c
index 13a8204a4f..b3d0874ce9 100644
--- a/lib/tempname.c
+++ b/lib/tempname.c
@@ -44,12 +44,8 @@
#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>
diff --git a/lib/userspec.c b/lib/userspec.c
index 19443ec912..6e58b486c7 100644
--- a/lib/userspec.c
+++ b/lib/userspec.c
@@ -33,19 +33,8 @@
#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>
diff --git a/lib/xgethostname.c b/lib/xgethostname.c
index 5178784bac..c0939945bb 100644
--- a/lib/xgethostname.c
+++ b/lib/xgethostname.c
@@ -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;
diff --git a/lib/xmalloc.c b/lib/xmalloc.c
index ead50393d3..82980ea58c 100644
--- a/lib/xmalloc.c
+++ b/lib/xmalloc.c
@@ -21,16 +21,9 @@
# 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
diff --git a/lib/xstrtod.c b/lib/xstrtod.c
index 4b4c12afb7..8450829bd2 100644
--- a/lib/xstrtod.c
+++ b/lib/xstrtod.c
@@ -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
@@ -21,16 +21,12 @@
# 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;
diff --git a/lib/xstrtol.c b/lib/xstrtol.c
index 73d87bacb2..4be09f1693 100644
--- a/lib/xstrtol.c
+++ b/lib/xstrtol.c
@@ -33,21 +33,10 @@
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;
diff --git a/m4/mkstemp.m4 b/m4/mkstemp.m4
index fd182935d4..3d379fd2bf 100644
--- a/m4/mkstemp.m4
+++ b/m4/mkstemp.m4
@@ -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)
diff --git a/m4/strdup.m4 b/m4/strdup.m4
index 08087063d8..effeb60eac 100644
--- a/m4/strdup.m4
+++ b/m4/strdup.m4
@@ -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])
:
])
diff --git a/m4/strtod.m4 b/m4/strtod.m4
index 809a83fa80..fb742f7d58 100644
--- a/m4/strtod.m4
+++ b/m4/strtod.m4
@@ -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)
])
diff --git a/m4/strtoimax.m4 b/m4/strtoimax.m4
index 7a338f2aa8..2cc1776d72 100644
--- a/m4/strtoimax.m4
+++ b/m4/strtoimax.m4
@@ -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])
])
diff --git a/m4/strtol.m4 b/m4/strtol.m4
index 59a74f655d..7740eccdab 100644
--- a/m4/strtol.m4
+++ b/m4/strtol.m4
@@ -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)
])
diff --git a/m4/userspec.m4 b/m4/userspec.m4
index 862c871709..df78b83cc3 100644
--- a/m4/userspec.m4
+++ b/m4/userspec.m4
@@ -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)
])
diff --git a/m4/xalloc.m4 b/m4/xalloc.m4
index 5dcb730539..9f6e87d03c 100644
--- a/m4/xalloc.m4
+++ b/m4/xalloc.m4
@@ -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])
])
diff --git a/m4/xstrtod.m4 b/m4/xstrtod.m4
index 4056d8cf0e..93528c2f51 100644
--- a/m4/xstrtod.m4
+++ b/m4/xstrtod.m4
@@ -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])
+ :
])
diff --git a/m4/xstrtol.m4 b/m4/xstrtol.m4
index 86d14b68c0..a21ab2b05a 100644
--- a/m4/xstrtol.m4
+++ b/m4/xstrtol.m4
@@ -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])
])