diff options
author | Roland McGrath <roland@redhat.com> | 2010-06-15 23:10:35 -0700 |
---|---|---|
committer | Roland McGrath <roland@redhat.com> | 2010-06-16 12:11:03 -0700 |
commit | 3e0f7d1d1b817040cef82f41879f471ab59b663e (patch) | |
tree | 42999dc59b7bab5c0524f15a7f928cb2905f49d5 /lib | |
parent | 3e4b5bbeca8987527c11a1ea048459a7ebd4ab5e (diff) |
Handle reading .debug_types section.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ChangeLog | 6 | ||||
-rw-r--r-- | lib/dynamicsizehash.c | 18 | ||||
-rw-r--r-- | lib/dynamicsizehash.h | 21 |
3 files changed, 28 insertions, 17 deletions
diff --git a/lib/ChangeLog b/lib/ChangeLog index 089747aa..1b8b42bc 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,9 @@ +2010-06-16 Roland McGrath <roland@redhat.com> + + * dynamicsizehash.h (HASHTYPE): New macro. + (struct): Use size_t for table sizes. + * dynamicsizehash.c: Likewise. Use HASHTYPE for hash values. + 2010-02-15 Roland McGrath <roland@redhat.com> * Makefile.am: Use config/eu.am for common stuff. diff --git a/lib/dynamicsizehash.c b/lib/dynamicsizehash.c index b645da6a..24335d42 100644 --- a/lib/dynamicsizehash.c +++ b/lib/dynamicsizehash.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2001, 2002, 2005 Red Hat, Inc. +/* Copyright (C) 2000-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. @@ -67,7 +67,7 @@ static size_t lookup (htab, hval, val) NAME *htab; - unsigned long int hval; + HASHTYPE hval; TYPE val __attribute__ ((unused)); { /* First hash function: simply take the modul but prevent zero. */ @@ -75,7 +75,7 @@ lookup (htab, hval, val) if (htab->table[idx].hashval != 0) { - unsigned long int hash; + HASHTYPE hash; if (htab->table[idx].hashval == hval && COMPARE (htab->table[idx].data, val) == 0) @@ -103,7 +103,7 @@ lookup (htab, hval, val) static void -insert_entry_2 (NAME *htab, unsigned long int hval, size_t idx, TYPE data) +insert_entry_2 (NAME *htab, HASHTYPE hval, size_t idx, TYPE data) { #ifdef ITERATE if (htab->table[idx].hashval == 0) @@ -137,7 +137,7 @@ insert_entry_2 (NAME *htab, unsigned long int hval, size_t idx, TYPE data) __typeof__ (htab->first) runp; # endif #else - unsigned long int old_size = htab->size; + size_t old_size = htab->size; #endif #define _TABLE(name) \ name##_ent *table = htab->table @@ -198,7 +198,7 @@ int name##_init INIT(NAME) (htab, init_size) NAME *htab; - unsigned long int init_size; + size_t init_size; { /* We need the size to be a prime. */ init_size = next_prime (init_size); @@ -235,7 +235,7 @@ int name##_insert INSERT(NAME) (htab, hval, data) NAME *htab; - unsigned long int hval; + HASHTYPE hval; TYPE data; { size_t idx; @@ -262,7 +262,7 @@ int name##_overwrite INSERT(NAME) (htab, hval, data) NAME *htab; - unsigned long int hval; + HASHTYPE hval; TYPE data; { size_t idx; @@ -285,7 +285,7 @@ TYPE name##_find FIND(NAME) (htab, hval, val) NAME *htab; - unsigned long int hval; + HASHTYPE hval; TYPE val; { size_t idx; diff --git a/lib/dynamicsizehash.h b/lib/dynamicsizehash.h index 7cbb169d..f169d5e7 100644 --- a/lib/dynamicsizehash.h +++ b/lib/dynamicsizehash.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2001, 2002 Red Hat, Inc. +/* Copyright (C) 2000-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. @@ -57,6 +57,7 @@ The following macros if present select features: ITERATE iterating over the table entries is possible + HASHTYPE integer type for hash values, default unsigned long int */ @@ -69,6 +70,10 @@ # define NEXT(name) #endif +#ifndef HASHTYPE +# define HASHTYPE unsigned long int +#endif + /* Defined separately. */ extern size_t next_prime (size_t seed); @@ -78,7 +83,7 @@ extern size_t next_prime (size_t seed); #define _DYNHASHENTTYPE(name) \ typedef struct name##_ent \ { \ - unsigned long int hashval; \ + HASHTYPE hashval; \ TYPE data; \ NEXT (name) \ } name##_ent @@ -90,8 +95,8 @@ DYNHASHENTTYPE (NAME); #define _DYNHASHTYPE(name) \ typedef struct \ { \ - unsigned long int size; \ - unsigned long int filled; \ + size_t size; \ + size_t filled; \ name##_ent *table; \ FIRST (name) \ } name @@ -102,19 +107,19 @@ DYNHASHTYPE (NAME); #define _FUNCTIONS(name) \ /* Initialize the hash table. */ \ -extern int name##_init (name *htab, unsigned long int init_size); \ +extern int name##_init (name *htab, size_t init_size); \ \ /* Free resources allocated for hash table. */ \ extern int name##_free (name *htab); \ \ /* Insert new entry. */ \ -extern int name##_insert (name *htab, unsigned long int hval, TYPE data); \ +extern int name##_insert (name *htab, HASHTYPE hval, TYPE data); \ \ /* Insert new entry, possibly overwrite old entry. */ \ -extern int name##_overwrite (name *htab, unsigned long int hval, TYPE data); \ +extern int name##_overwrite (name *htab, HASHTYPE hval, TYPE data); \ \ /* Find entry in hash table. */ \ -extern TYPE name##_find (name *htab, unsigned long int hval, TYPE val); +extern TYPE name##_find (name *htab, HASHTYPE hval, TYPE val); #define FUNCTIONS(name) _FUNCTIONS (name) FUNCTIONS (NAME) |