mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
Clean up GCC warnings.
* src/reader.c (copy_action): `buf' is not used. (parse_skel_decl): Be static. * src/muscle_tab.c (mhash1, mhash2, muscle_insert): Preserve `const'. * src/options.h (create_long_option_table): Have a real prototype. * lib/hash.c, lib/hash.h (hash_insert, hash_insert_at, hash_delete) (hash_delete_at): Return const void *. Adjust casts to preserve the const.
This commit is contained in:
14
lib/hash.c
14
lib/hash.c
@@ -1,5 +1,5 @@
|
||||
/* hash.c -- hash table maintenance
|
||||
Copyright (C) 1995 Free Software Foundation, Inc.
|
||||
Copyright 1995, 2001 Free Software Foundation, Inc.
|
||||
Written by Greg McGary <gkm@gnu.ai.mit.edu>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -120,17 +120,17 @@ hash_find_item (struct hash_table* ht, void const *key)
|
||||
return ((HASH_VACANT (*slot)) ? 0 : *slot);
|
||||
}
|
||||
|
||||
void *
|
||||
const void *
|
||||
hash_insert (struct hash_table* ht, void *item)
|
||||
{
|
||||
void **slot = hash_find_slot (ht, item);
|
||||
return hash_insert_at (ht, item, slot);
|
||||
}
|
||||
|
||||
void *
|
||||
const void *
|
||||
hash_insert_at (struct hash_table* ht, void *item, void const *slot)
|
||||
{
|
||||
void *old_item = *(void **) slot;
|
||||
const void *old_item = *(const void **) slot;
|
||||
if (HASH_VACANT (old_item))
|
||||
{
|
||||
ht->ht_fill++;
|
||||
@@ -142,17 +142,17 @@ hash_insert_at (struct hash_table* ht, void *item, void const *slot)
|
||||
return old_item;
|
||||
}
|
||||
|
||||
void *
|
||||
const void *
|
||||
hash_delete (struct hash_table* ht, void const *item)
|
||||
{
|
||||
void **slot = hash_find_slot (ht, item);
|
||||
return hash_delete_at (ht, slot);
|
||||
}
|
||||
|
||||
void *
|
||||
const void *
|
||||
hash_delete_at (struct hash_table* ht, void const *slot)
|
||||
{
|
||||
void *item = *(void **) slot;
|
||||
const void *item = *(const void **) slot;
|
||||
if (!HASH_VACANT (item))
|
||||
{
|
||||
*(void const **) slot = hash_deleted_item;
|
||||
|
||||
13
lib/hash.h
13
lib/hash.h
@@ -1,5 +1,5 @@
|
||||
/* hash.h -- decls for hash table
|
||||
Copyright (C) 1995 Free Software Foundation, Inc.
|
||||
Copyright 1995, 2001 Free Software Foundation, Inc.
|
||||
Written by Greg McGary <gkm@gnu.ai.mit.edu>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -47,10 +47,10 @@ void hash_load __P((struct hash_table *ht, void *item_table,
|
||||
unsigned long cardinality, unsigned long size));
|
||||
void **hash_find_slot __P((struct hash_table *ht, void const *key));
|
||||
void *hash_find_item __P((struct hash_table *ht, void const *key));
|
||||
void *hash_insert __P((struct hash_table *ht, void *item));
|
||||
void *hash_insert_at __P((struct hash_table *ht, void *item, void const *slot));
|
||||
void *hash_delete __P((struct hash_table *ht, void const *item));
|
||||
void *hash_delete_at __P((struct hash_table *ht, void const *slot));
|
||||
const void *hash_insert __P((struct hash_table *ht, void *item));
|
||||
const void *hash_insert_at __P((struct hash_table *ht, void *item, void const *slot));
|
||||
const void *hash_delete __P((struct hash_table *ht, void const *item));
|
||||
const void *hash_delete_at __P((struct hash_table *ht, void const *slot));
|
||||
void hash_delete_items __P((struct hash_table *ht));
|
||||
void hash_free_items __P((struct hash_table *ht));
|
||||
void hash_free __P((struct hash_table *ht, int free_items));
|
||||
@@ -59,7 +59,8 @@ void hash_print_stats __P((struct hash_table *ht, FILE *out_FILE));
|
||||
void **hash_dump __P((struct hash_table *ht, void **vector_0, qsort_cmp_t compare));
|
||||
|
||||
extern void *hash_deleted_item;
|
||||
#define HASH_VACANT(item) ((item) == 0 || (void *) (item) == hash_deleted_item)
|
||||
#define HASH_VACANT(item) \
|
||||
((item) == 0 || (const void *) (item) == hash_deleted_item)
|
||||
|
||||
|
||||
/* hash and comparison macros for string keys. */
|
||||
|
||||
Reference in New Issue
Block a user