diff options
author | David Edelsohn <dje.gcc@gmail.com> | 1995-08-02 16:48:02 +0000 |
---|---|---|
committer | David Edelsohn <dje.gcc@gmail.com> | 1995-08-02 16:48:02 +0000 |
commit | 1a67b3b682d0fd7ad79c039e441d7ba415419c23 (patch) | |
tree | 5642ba71f5095c7abb092e84c912037d0682355b /opcodes/sparc-dis.c | |
parent | f069afb4eb539bd89f9a163f82bd8e30ba6132f3 (diff) | |
download | gdb-1a67b3b682d0fd7ad79c039e441d7ba415419c23.zip gdb-1a67b3b682d0fd7ad79c039e441d7ba415419c23.tar.gz gdb-1a67b3b682d0fd7ad79c039e441d7ba415419c23.tar.bz2 |
(build_hash_table): Allocate all entries at once.
Diffstat (limited to 'opcodes/sparc-dis.c')
-rw-r--r-- | opcodes/sparc-dis.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/opcodes/sparc-dis.c b/opcodes/sparc-dis.c index 532fb94..1dc2e35 100644 --- a/opcodes/sparc-dis.c +++ b/opcodes/sparc-dis.c @@ -759,8 +759,9 @@ build_hash_table (table, hash_table, num_opcodes) struct opcode_hash **hash_table; int num_opcodes; { - int i; + register int i; int hash_count[HASH_SIZE]; + struct opcode_hash *hash_buf; /* Start at the end of the table and work backwards so that each chain is sorted. */ @@ -768,10 +769,11 @@ build_hash_table (table, hash_table, num_opcodes) memset (hash_table, 0, HASH_SIZE * sizeof (hash_table[0])); memset (hash_count, 0, HASH_SIZE * sizeof (hash_count[0])); + hash_buf = (struct opcode_hash *) xmalloc (sizeof (struct opcode_hash) * num_opcodes); for (i = num_opcodes - 1; i >= 0; --i) { - int hash = HASH_INSN (sparc_opcodes[i].match); - struct opcode_hash *h = (struct opcode_hash *) xmalloc (sizeof (struct opcode_hash)); + register int hash = HASH_INSN (sparc_opcodes[i].match); + register struct opcode_hash *h = &hash_buf[i]; h->next = hash_table[hash]; h->opcode = &sparc_opcodes[i]; hash_table[hash] = h; |