(find_key): First arg now has type `DOH *' to match callers.

Internally, this is immediately converted to `char *'.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@438 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Thien-Thi Nguyen 2000-05-11 07:59:31 +00:00
commit 250b280a50

View file

@ -1,12 +1,12 @@
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
* hash.c * hash.c
* *
* Implements a simple hash table object. * Implements a simple hash table object.
* *
* Author(s) : David Beazley (beazley@cs.uchicago.edu) * Author(s) : David Beazley (beazley@cs.uchicago.edu)
* *
* Copyright (C) 1999-2000. The University of Chicago * Copyright (C) 1999-2000. The University of Chicago
* See the file LICENSE for information on usage and redistribution. * See the file LICENSE for information on usage and redistribution.
* ----------------------------------------------------------------------------- */ * ----------------------------------------------------------------------------- */
static char cvsroot[] = "$Header$"; static char cvsroot[] = "$Header$";
@ -15,7 +15,7 @@ static char cvsroot[] = "$Header$";
/* Hash node */ /* Hash node */
typedef struct HashNode { typedef struct HashNode {
DOH *key; DOH *key;
DOH *object; DOH *object;
struct HashNode *next; struct HashNode *next;
} HashNode; } HashNode;
@ -41,7 +41,8 @@ typedef struct KeyValue {
static KeyValue *root = 0; static KeyValue *root = 0;
/* Find or create a key in the interned key table */ /* Find or create a key in the interned key table */
static DOH *find_key(char *c) { static DOH *find_key (DOH *doh_c) {
char *c = (char *) doh_c;
KeyValue *r, *s; KeyValue *r, *s;
int d = 0; int d = 0;
r = root; r = root;
@ -95,7 +96,7 @@ static void DelNode(HashNode *hn) {
* Delete a hash table. * Delete a hash table.
* ----------------------------------------------------------------------------- */ * ----------------------------------------------------------------------------- */
static void static void
DelHash(DOH *ho) { DelHash(DOH *ho) {
Hash *h; Hash *h;
HashNode *n,*next; HashNode *n,*next;
@ -112,7 +113,7 @@ DelHash(DOH *ho) {
} }
} }
DohFree(h->hashtable); DohFree(h->hashtable);
h->hashtable = 0; h->hashtable = 0;
h->hashsize = 0; h->hashsize = 0;
Delete(h->file); Delete(h->file);
DohObjFree(h); DohObjFree(h);
@ -166,7 +167,7 @@ static void resize(Hash *h) {
} }
p = p + 2; p = p + 2;
} }
table = (HashNode **) DohMalloc(newsize*sizeof(HashNode *)); table = (HashNode **) DohMalloc(newsize*sizeof(HashNode *));
for (i = 0; i < newsize; i++ ) { for (i = 0; i < newsize; i++ ) {
table[i] = 0; table[i] = 0;
@ -196,7 +197,7 @@ static void resize(Hash *h) {
* exists. * exists.
* ----------------------------------------------------------------------------- */ * ----------------------------------------------------------------------------- */
static int static int
Hash_setattr(DOH *ho, DOH *k, DOH *obj) { Hash_setattr(DOH *ho, DOH *k, DOH *obj) {
int hv; int hv;
HashNode *n, *prev; HashNode *n, *prev;
@ -385,14 +386,14 @@ Hash_str(DOH *ho) {
h->flags = h->flags & ~DOH_FLAG_PRINT; h->flags = h->flags & ~DOH_FLAG_PRINT;
return s; return s;
} }
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
* Hash_len() * Hash_len()
* *
* Return number of entries in the hash table. * Return number of entries in the hash table.
* ----------------------------------------------------------------------------- */ * ----------------------------------------------------------------------------- */
static int static int
Hash_len(DOH *ho) { Hash_len(DOH *ho) {
Hash *h = (Hash *) ho; Hash *h = (Hash *) ho;
return h->nitems; return h->nitems;