second set of ANSI C changes: C89-style function declarations, more inline functions, remove register keyword

This commit is contained in:
Chet Ramey
2023-01-03 10:23:11 -05:00
parent 81e3a4fb07
commit a61ffa78ed
85 changed files with 2867 additions and 5479 deletions
+8 -13
View File
@@ -1,7 +1,7 @@
/* hashcmd.c - functions for managing a hash table mapping command names to
full pathnames. */
/* Copyright (C) 1997-2021 Free Software Foundation, Inc.
/* Copyright (C) 1997-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -37,25 +37,24 @@
HASH_TABLE *hashed_filenames = (HASH_TABLE *)NULL;
static void phash_freedata PARAMS((PTR_T));
static void phash_freedata (PTR_T);
void
phash_create ()
phash_create (void)
{
if (hashed_filenames == 0)
hashed_filenames = hash_create (FILENAME_HASH_BUCKETS);
}
static void
phash_freedata (data)
PTR_T data;
phash_freedata (PTR_T data)
{
free (((PATH_DATA *)data)->path);
free (data);
}
void
phash_flush ()
phash_flush (void)
{
if (hashed_filenames)
hash_flush (hashed_filenames, phash_freedata);
@@ -63,8 +62,7 @@ phash_flush ()
/* Remove FILENAME from the table of hashed commands. */
int
phash_remove (filename)
const char *filename;
phash_remove (const char *filename)
{
register BUCKET_CONTENTS *item;
@@ -89,9 +87,7 @@ phash_remove (filename)
in a directory in $PATH that is not an absolute pathname.
FOUND is the initial value for times_found. */
void
phash_insert (filename, full_path, check_dot, found)
char *filename, *full_path;
int check_dot, found;
phash_insert (char *filename, char *full_path, int check_dot, int found)
{
register BUCKET_CONTENTS *item;
@@ -124,8 +120,7 @@ phash_insert (filename, full_path, check_dot, found)
returns a newly-allocated string; the caller is responsible
for freeing it. */
char *
phash_search (filename)
const char *filename;
phash_search (const char *filename)
{
register BUCKET_CONTENTS *item;
char *path, *dotted_filename, *tail;