ansideclify

This commit is contained in:
Jim Meyering 1998-12-07 03:12:10 +00:00
parent 604b3b397d
commit 7d60769bea
30 changed files with 68 additions and 188 deletions

View File

@ -161,8 +161,7 @@ static header *last_alloca_header = NULL; /* -> last alloca header. */
implementations of C, for example under Gould's UTX/32. */
pointer
alloca (size)
unsigned size;
alloca (unsigned size)
{
auto char probe; /* Probes stack depth: */
register char *depth = ADDRESS_FUNCTION (probe);

View File

@ -34,10 +34,7 @@
/* FIXME: describe. */
int
rpl_chown (file, uid, gid)
const char *file;
uid_t uid;
gid_t gid;
rpl_chown (const char *file, uid_t uid, gid_t gid)
{
if (gid == (gid_t) -1 || uid == (uid_t) -1)
{

View File

@ -39,8 +39,7 @@ char *malloc ();
removed. */
char *
dirname (path)
char *path;
dirname (char *path)
{
char *newpath;
char *slash;

View File

@ -1,5 +1,5 @@
/* euidaccess -- check if effective user id can access file
Copyright (C) 1990, 1991, 1995 Free Software Foundation, Inc.
Copyright (C) 1990, 1991, 1995, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@ -127,9 +127,7 @@ int group_member ();
filesystem, text busy, etc. */
int
euidaccess (path, mode)
const char *path;
int mode;
euidaccess (const char *path, int mode)
{
struct stat stats;
int granted;

View File

@ -50,8 +50,7 @@ typedef long daddr_t; /* for disk address */
/* Return the number of 512-byte blocks in a file of SIZE bytes. */
off_t
st_blocks (size)
off_t size;
st_blocks (off_t size)
{
off_t datablks = size / 512 + (size % 512 != 0);
off_t indrblks = 0;

View File

@ -55,10 +55,7 @@ extern int errno;
/* Match STRING against the filename pattern PATTERN, returning zero if
it matches, nonzero if not. */
int
fnmatch (pattern, string, flags)
const char *pattern;
const char *string;
int flags;
fnmatch (const char *pattern, const char *string, int flags)
{
register const char *p = pattern, *n = string;
register char c;

View File

@ -101,10 +101,7 @@ int safe_read ();
ERRNO is either a system error value, or zero if DISK is NULL
on a system that requires a non-NULL value. */
int
get_fs_usage (path, disk, fsp)
const char *path;
const char *disk;
struct fs_usage *fsp;
get_fs_usage (const char *path, const char *disk, struct fs_usage *fsp)
{
#ifdef STAT_STATFS3_OSF1
@ -262,9 +259,7 @@ get_fs_usage (path, disk, fsp)
/* AIX PS/2 does not supply statfs. */
int
statfs (path, fsb)
char *path;
struct statfs *fsb;
statfs (char *path, struct statfs *fsb)
{
struct stat stats;
struct dustat fsd;

View File

@ -11,9 +11,7 @@
#ifdef F_CHSIZE
int
ftruncate (fd, length)
int fd;
off_t length;
ftruncate (int fd, off_t length)
{
return fcntl (fd, F_CHSIZE, length);
}
@ -30,9 +28,7 @@ ftruncate (fd, length)
# endif
int
ftruncate (fd, length)
int fd;
off_t length;
ftruncate (int fd, off_t length)
{
struct flock fl;
struct stat filebuf;
@ -75,9 +71,7 @@ ftruncate (fd, length)
# if HAVE_CHSIZE
int
ftruncate (fd, length)
int fd;
off_t length;
ftruncate (int fd, off_t length)
{
return chsize (fd, length);
}
@ -90,9 +84,7 @@ extern int errno;
# endif
int
ftruncate (fd, length)
int fd;
off_t length;
ftruncate (int fd, off_t length)
{
errno = EIO;
return -1;

View File

@ -1,6 +1,6 @@
/* getline.c -- Replacement for GNU C library function getline
Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc.
Copyright (C) 1993, 1996, 1997, 1998 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
@ -34,10 +34,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#if defined __GNU_LIBRARY__ && HAVE_GETDELIM
int
getline (lineptr, n, stream)
char **lineptr;
size_t *n;
FILE *stream;
getline (char **lineptr, size_t *n, FILE *stream)
{
return getdelim (lineptr, n, '\n', stream);
}
@ -64,12 +61,7 @@ char *malloc (), *realloc ();
null terminator), or -1 on error or EOF. */
int
getstr (lineptr, n, stream, terminator, offset)
char **lineptr;
size_t *n;
FILE *stream;
char terminator;
size_t offset;
getstr (char **lineptr, size_t *n, FILE *stream, char terminator, size_t offset)
{
int nchars_avail; /* Allocated but unused chars in *LINEPTR. */
char *read_pos; /* Where we're reading into *LINEPTR. */
@ -138,20 +130,13 @@ getstr (lineptr, n, stream, terminator, offset)
}
int
getline (lineptr, n, stream)
char **lineptr;
size_t *n;
FILE *stream;
getline (char **lineptr, size_t *n, FILE *stream)
{
return getstr (lineptr, n, stream, '\n', 0);
}
int
getdelim (lineptr, n, delimiter, stream)
char **lineptr;
size_t *n;
int delimiter;
FILE *stream;
getdelim (char **lineptr, size_t *n, int delimiter, FILE *stream)
{
return getstr (lineptr, n, stream, delimiter, 0);
}

View File

@ -1,5 +1,5 @@
/* getversion.c -- select backup filename type
Copyright (C) 1990 Free Software Foundation, Inc.
Copyright (C) 1990, 1998 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
@ -46,8 +46,7 @@ static const enum backup_type backup_types[] =
Unique abbreviations are accepted. */
enum backup_type
get_version (version)
char *version;
get_version (const char *version)
{
int i;

View File

@ -34,8 +34,7 @@
return nonzero, else 0. */
int
isdir (path)
char *path;
isdir (const char *path)
{
struct stat stats;

View File

@ -1,5 +1,5 @@
/* Work around bug on some systems where malloc (0) fails.
Copyright (C) 1997 Free Software Foundation, Inc.
Copyright (C) 1997, 1998 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
@ -30,8 +30,7 @@ char *malloc ();
If N is zero, allocate a 1-byte block. */
char *
rpl_malloc (n)
size_t n;
rpl_malloc (size_t n)
{
if (n == 0)
n = 1;

View File

@ -104,8 +104,7 @@ static int memcmp_bytes __P((op_t, op_t));
__inline
# endif
static int
memcmp_bytes (a, b)
op_t a, b;
memcmp_bytes (long unsigned int a, long unsigned int b)
{
long int srcp1 = (long int) &a;
long int srcp2 = (long int) &b;
@ -132,10 +131,7 @@ static int memcmp_common_alignment __P((long, long, size_t));
__inline
#endif
static int
memcmp_common_alignment (srcp1, srcp2, len)
long int srcp1;
long int srcp2;
size_t len;
memcmp_common_alignment (long int srcp1, long int srcp2, size_t len)
{
op_t a0, a1;
op_t b0, b1;
@ -222,10 +218,7 @@ static int memcmp_not_common_alignment __P((long, long, size_t));
__inline
#endif
static int
memcmp_not_common_alignment (srcp1, srcp2, len)
long int srcp1;
long int srcp2;
size_t len;
memcmp_not_common_alignment (long int srcp1, long int srcp2, size_t len)
{
op_t a0, a1, a2, a3;
op_t b0, b1, b2, b3;
@ -325,10 +318,7 @@ memcmp_not_common_alignment (srcp1, srcp2, len)
}
int
rpl_memcmp (s1, s2, len)
const __ptr_t s1;
const __ptr_t s2;
size_t len;
rpl_memcmp (const void *s1, const void *s2, size_t len)
{
op_t a0;
op_t b0;

View File

@ -16,10 +16,7 @@
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
char *
memset (str, c, len)
char *str;
int c;
unsigned len;
memset (char *str, int c, unsigned int len)
{
register char *st = str;

View File

@ -1,5 +1,5 @@
/* BSD compatible make directory function for System V
Copyright (C) 1988, 1990 Free Software Foundation, Inc.
Copyright (C) 1988, 1990, 1998 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
@ -48,9 +48,7 @@ extern int errno;
subroutine didn't return EEXIST. It does now. */
int
mkdir (dpath, dmode)
char *dpath;
int dmode;
mkdir (const char *dpath, int dmode)
{
int cpid, status;
struct stat statbuf;

View File

@ -126,9 +126,7 @@ time_t __mktime_internal __P ((struct tm *,
are buggy. */
static struct tm *my_mktime_localtime_r __P ((const time_t *, struct tm *));
static struct tm *
my_mktime_localtime_r (t, tp)
const time_t *t;
struct tm *tp;
my_mktime_localtime_r (const time_t *t, struct tm *tp)
{
struct tm *l = localtime (t);
if (! l)
@ -146,9 +144,8 @@ my_mktime_localtime_r (t, tp)
If TP is null, return a nonzero value.
If overflow occurs, yield the low order bits of the correct answer. */
static time_t
ydhms_tm_diff (year, yday, hour, min, sec, tp)
int year, yday, hour, min, sec;
const struct tm *tp;
ydhms_tm_diff (int year, int yday, int hour, int min, int sec,
const struct tm *tp)
{
if (!tp)
return 1;
@ -180,8 +177,7 @@ static time_t localtime_offset;
/* Convert *TP to a time_t value. */
time_t
mktime (tp)
struct tm *tp;
mktime (struct tm *tp)
{
#ifdef _LIBC
/* POSIX.1 8.1.1 requires that whenever mktime() is called, the
@ -197,10 +193,8 @@ mktime (tp)
If *T is out of range for conversion, adjust it so that
it is the nearest in-range value and then convert that. */
static struct tm *
ranged_convert (convert, t, tp)
struct tm *(*convert) __P ((const time_t *, struct tm *));
time_t *t;
struct tm *tp;
ranged_convert (struct tm *(*convert) (const time_t *, struct tm *),
time_t *t, struct tm *tp)
{
struct tm *r;
@ -247,10 +241,9 @@ ranged_convert (convert, t, tp)
compared to what the result would be for UTC without leap seconds.
If *OFFSET's guess is correct, only one CONVERT call is needed. */
time_t
__mktime_internal (tp, convert, offset)
struct tm *tp;
struct tm *(*convert) __P ((const time_t *, struct tm *));
time_t *offset;
__mktime_internal (struct tm *tp,
struct tm *(*convert) (const time_t *, struct tm *),
time_t *offset)
{
time_t t, dt, t0, t1, t2;
struct tm tm;

View File

@ -42,10 +42,7 @@ char *malloc ();
BASE in the returned concatenation. */
char *
path_concat (dir, base, base_in_result)
const char *dir;
const char *base;
char **base_in_result;
path_concat (const char *dir, const char *base, char **base_in_result)
{
char *p;
char *p_concat;

View File

@ -38,9 +38,7 @@ extern int errno;
Return 0 if successful, -1 if not. */
int
rename (from, to)
char *from;
char *to;
rename (char *from, char *to)
{
struct stat from_stats, to_stats;
int pid, status;

View File

@ -40,13 +40,7 @@
#endif
static int
try (response, pattern, match, nomatch, lastp, re)
const char *response;
const char *pattern;
const int match;
const int nomatch;
const char **lastp;
regex_t *re;
try (const char *response, const char *pattern, const int match, const int nomatch, const char **lastp, regex_t *re)
{
if (pattern != *lastp)
{
@ -69,8 +63,7 @@ try (response, pattern, match, nomatch, lastp, re)
int
rpmatch (response)
const char *response;
rpmatch (const char *response)
{
/* Match against one of the response patterns, compiling the pattern
first if necessary. */

View File

@ -57,8 +57,7 @@ char *xgetcwd PARAMS ((void));
called, but doing so is ok. Otherwise, return zero. */
int
save_cwd (cwd)
struct saved_cwd *cwd;
save_cwd (struct saved_cwd *cwd)
{
static int have_working_fchdir = 1;
@ -118,10 +117,7 @@ save_cwd (cwd)
*/
int
restore_cwd (cwd, dest, from)
const struct saved_cwd *cwd;
const char *dest;
const char *from;
restore_cwd (const struct saved_cwd *cwd, const char *dest, const char *from)
{
int fail = 0;
if (cwd->desc >= 0)
@ -144,8 +140,7 @@ restore_cwd (cwd, dest, from)
}
void
free_cwd (cwd)
struct saved_cwd *cwd;
free_cwd (struct saved_cwd *cwd)
{
if (cwd->desc >= 0)
close (cwd->desc);

View File

@ -76,9 +76,7 @@ char *stpcpy ();
Return NULL if DIR cannot be opened or if out of memory. */
char *
savedir (dir, name_size)
const char *dir;
unsigned int name_size;
savedir (const char *dir, unsigned int name_size)
{
DIR *dirp;
struct dirent *dp;

View File

@ -34,9 +34,7 @@
/* Copy SRC to DEST, returning the address of the terminating '\0' in DEST. */
char *
__stpcpy (dest, src)
char *dest;
const char *src;
__stpcpy (char *dest, const char *src)
{
register char *d = dest;
register const char *s = src;

View File

@ -31,8 +31,7 @@ char *strcpy ();
or 0 if out of memory. */
char *
strdup (str)
const char *str;
strdup (const char *str)
{
char *newstr;

View File

@ -157,9 +157,7 @@ extern char *tzname[];
# if ! HAVE_TM_GMTOFF
static struct tm *my_strftime_gmtime_r __P ((const time_t *, struct tm *));
static struct tm *
my_strftime_gmtime_r (t, tp)
const time_t *t;
struct tm *tp;
my_strftime_gmtime_r (const time_t *t, struct tm *tp)
{
struct tm *l = gmtime (t);
if (! l)
@ -171,9 +169,7 @@ my_strftime_gmtime_r (t, tp)
static struct tm *my_strftime_localtime_r __P ((const time_t *, struct tm *));
static struct tm *
my_strftime_localtime_r (t, tp)
const time_t *t;
struct tm *tp;
my_strftime_localtime_r (const time_t *t, struct tm *tp)
{
struct tm *l = localtime (t);
if (! l)
@ -274,10 +270,7 @@ static const char zeroes[16] = /* "0000000000000000" */
static char *memcpy_lowcase __P ((char *dest, const char *src, size_t len));
static char *
memcpy_lowcase (dest, src, len)
char *dest;
const char *src;
size_t len;
memcpy_lowcase (char *dest, const char *src, size_t len)
{
while (len-- > 0)
dest[len] = TOLOWER ((unsigned char) src[len]);
@ -287,10 +280,7 @@ memcpy_lowcase (dest, src, len)
static char *memcpy_uppcase __P ((char *dest, const char *src, size_t len));
static char *
memcpy_uppcase (dest, src, len)
char *dest;
const char *src;
size_t len;
memcpy_uppcase (char *dest, const char *src, size_t len)
{
while (len-- > 0)
dest[len] = TOUPPER ((unsigned char) src[len]);
@ -304,9 +294,7 @@ memcpy_uppcase (dest, src, len)
# define tm_diff ftime_tm_diff
static int tm_diff __P ((const struct tm *, const struct tm *));
static int
tm_diff (a, b)
const struct tm *a;
const struct tm *b;
tm_diff (const struct tm *a, const struct tm *b)
{
/* Compute intervening leap days correctly even if year is negative.
Take care to avoid int overflow in leap day calculations,
@ -341,9 +329,7 @@ static int iso_week_days __P ((int, int));
__inline__
#endif
static int
iso_week_days (yday, wday)
int yday;
int wday;
iso_week_days (int yday, int wday)
{
/* Add enough to the first operand of % to make it nonnegative. */
int big_enough_multiple_of_7 = (-YDAY_MINIMUM / 7 + 2) * 7;
@ -411,12 +397,8 @@ static char const month_name[][10] =
anywhere, so to determine how many characters would be
written, use NULL for S and (size_t) UINT_MAX for MAXSIZE. */
size_t
my_strftime (s, maxsize, format, tp ut_argument)
char *s;
size_t maxsize;
const char *format;
const struct tm *tp;
ut_argument_spec
my_strftime (char *s, size_t maxsize, const char *format, const struct tm *tp
ut_argument_spec)
{
int hour12 = tp->tm_hour;
#ifdef _NL_CURRENT

View File

@ -32,8 +32,7 @@
when given a path that ends in "/" (except for the root directory). */
void
strip_trailing_slashes (path)
char *path;
strip_trailing_slashes (char *path)
{
int last;

View File

@ -33,9 +33,7 @@ char *malloc ();
/* Duplicate S, returning an identical malloc'd string. */
char *
strndup (s, n)
const char *s;
size_t n;
strndup (const char *s, size_t n)
{
char *new = malloc (n + 1);

View File

@ -30,9 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
typedef unsigned chartype;
char *
strstr (phaystack, pneedle)
const char *phaystack;
const char *pneedle;
strstr (const char *phaystack, const char *pneedle)
{
register const unsigned char *haystack, *needle;
register chartype b, c;

View File

@ -43,9 +43,7 @@
*/
int
strverscmp (s1, s2)
const char *s1;
const char *s2;
strverscmp (const char *s1, const char *s2)
{
const unsigned char *p1 = (const unsigned char *) s1;
const unsigned char *p2 = (const unsigned char *) s2;

View File

@ -93,8 +93,7 @@ char *strdup ();
otherwise return 0. */
static int
is_number (str)
const char *str;
is_number (const char *str)
{
for (; *str; str++)
if (!isdigit (*str))
@ -115,11 +114,7 @@ is_number (str)
Return NULL if successful, a static error message string if not. */
const char *
parse_user_spec (spec_arg, uid, gid, username_arg, groupname_arg)
const char *spec_arg;
uid_t *uid;
gid_t *gid;
char **username_arg, **groupname_arg;
parse_user_spec (const char *spec_arg, uid_t *uid, gid_t *gid, char **username_arg, char **groupname_arg)
{
static const char *tired = "virtual memory exhausted";
const char *error_msg;

View File

@ -1,5 +1,5 @@
/* xmalloc.c -- malloc with out of memory checking
Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
Copyright (C) 1990-1997, 98 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
@ -78,7 +78,7 @@ void error ();
#endif
static void
xalloc_fail ()
xalloc_fail (void)
{
if (xalloc_fail_func)
(*xalloc_fail_func) ();
@ -88,8 +88,7 @@ xalloc_fail ()
/* Allocate N bytes of memory dynamically, with error checking. */
void *
xmalloc (n)
size_t n;
xmalloc (size_t n)
{
void *p;
@ -104,9 +103,7 @@ xmalloc (n)
If P is NULL, run xmalloc. */
void *
xrealloc (p, n)
void *p;
size_t n;
xrealloc (void *p, size_t n)
{
p = realloc (p, n);
if (p == 0)
@ -119,8 +116,7 @@ xrealloc (p, n)
/* Allocate memory for N elements of S bytes, with error checking. */
void *
xcalloc (n, s)
size_t n, s;
xcalloc (size_t n, size_t s)
{
void *p;