summaryrefslogtreecommitdiff
path: root/labels.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-05-28 12:28:58 -0700
committerH. Peter Anvin <hpa@zytor.com>2008-05-28 12:28:58 -0700
commit166c247f36c800aa66d09779664c8e898f539939 (patch)
tree486836e03f128185a809bb33050a61f537be6c01 /labels.c
parent6e6cd16a456715ae333a9300daa8b0536ae3785c (diff)
downloadnasm-166c247f36c800aa66d09779664c8e898f539939.tar.gz
hash user allocates struct hash_table
struct hash_table, a fixed-sized structure, is now allocated by the caller. This lets us integrate it into the Context structure, thus avoiding an additional dynamically allocated object for no good reason. Add some minor code collapsing: make it more obvious that all that differs is a pointer value, rather than relying on the compiler to do tail merging.
Diffstat (limited to 'labels.c')
-rw-r--r--labels.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/labels.c b/labels.c
index 27d25dbe..8376b795 100644
--- a/labels.c
+++ b/labels.c
@@ -79,7 +79,7 @@ struct permts { /* permanent text storage */
extern bool global_offset_changed; /* defined in nasm.c */
-static struct hash_table *ltab; /* labels hash table */
+static struct hash_table ltab; /* labels hash table */
static union label *ldata; /* all label data blocks */
static union label *lfree; /* labels free block */
static struct permts *perm_head; /* start of perm. text storage */
@@ -122,7 +122,7 @@ static union label *find_label(char *label, int create)
prevlen = 0;
}
- lpp = (union label **) hash_find(ltab, label, &ip);
+ lpp = (union label **) hash_find(&ltab, label, &ip);
lptr = lpp ? *lpp : NULL;
if (lptr || !create)
@@ -371,7 +371,7 @@ void declare_as_global(char *label, char *special, efunc error)
int init_labels(void)
{
- ltab = hash_init(HASH_LARGE);
+ hash_init(&ltab, HASH_LARGE);
ldata = lfree = (union label *)nasm_malloc(LBLK_SIZE);
init_block(lfree);
@@ -396,7 +396,7 @@ void cleanup_labels(void)
initialized = false;
- hash_free(ltab);
+ hash_free(&ltab);
lptr = lhold = ldata;
while (lptr) {