projects
/
deliverable
/
binutils-gdb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
include/elf/
[deliverable/binutils-gdb.git]
/
gas
/
hash.c
diff --git
a/gas/hash.c
b/gas/hash.c
index 0f129fb3fa1938f4038d80ff960a1fbc5fd192df..e9931366fe07c428246d03fa0c5ec1e4a9a52e96 100644
(file)
--- a/
gas/hash.c
+++ b/
gas/hash.c
@@
-1,5
+1,6
@@
/* hash.c -- gas hash table code
/* hash.c -- gas hash table code
- Copyright (C) 1987, 90, 91, 92, 93, 94, 95, 96, 98, 1999
+ Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999,
+ 2000, 2001
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@
-29,6
+30,7
@@
structure. */
#include "as.h"
structure. */
#include "as.h"
+#include "safe-ctype.h"
#include "obstack.h"
/* The default number of entries to use when creating a hash table. */
#include "obstack.h"
/* The default number of entries to use when creating a hash table. */
@@
-37,8
+39,7
@@
/* An entry in a hash table. */
/* An entry in a hash table. */
-struct hash_entry
-{
+struct hash_entry {
/* Next entry for this hash code. */
struct hash_entry *next;
/* String being hashed. */
/* Next entry for this hash code. */
struct hash_entry *next;
/* String being hashed. */
@@
-52,8
+53,7
@@
struct hash_entry
/* A hash table. */
/* A hash table. */
-struct hash_control
-{
+struct hash_control {
/* The hash array. */
struct hash_entry **table;
/* The number of slots in the hash table. */
/* The hash array. */
struct hash_entry **table;
/* The number of slots in the hash table. */
@@
-99,7
+99,7
@@
hash_new ()
ret->deletions = 0;
#endif
ret->deletions = 0;
#endif
- return ret;
+ return ret;
}
/* Delete a hash table, freeing all allocated memory. */
}
/* Delete a hash table, freeing all allocated memory. */
@@
-222,7
+222,7
@@
hash_insert (table, key, value)
++table->insertions;
#endif
++table->insertions;
#endif
- p =
obstack_alloc (&table->memory, sizeof *p
);
+ p =
(struct hash_entry *) obstack_alloc (&table->memory, sizeof (*p)
);
p->string = key;
p->hash = hash;
p->data = value;
p->string = key;
p->hash = hash;
p->data = value;
@@
-262,7
+262,7
@@
hash_jam (table, key, value)
++table->insertions;
#endif
++table->insertions;
#endif
- p =
obstack_alloc (&table->memory, sizeof *p
);
+ p =
(struct hash_entry *) obstack_alloc (&table->memory, sizeof (*p)
);
p->string = key;
p->hash = hash;
p->data = value;
p->string = key;
p->hash = hash;
p->data = value;
@@
-415,14
+415,23
@@
hash_print_statistics (f, name, table)
/* This test program is left over from the old hash table code. */
/* This test program is left over from the old hash table code. */
-#define TABLES (6) /* number of hash tables to maintain */
- /* (at once) in any testing */
-#define STATBUFSIZE (12) /* we can have 12 statistics */
+/* Number of hash tables to maintain (at once) in any testing. */
+#define TABLES (6)
+
+/* We can have 12 statistics. */
+#define STATBUFSIZE (12)
+
+/* Display statistics here. */
+int statbuf[STATBUFSIZE];
+
+/* Human farts here. */
+char answer[100];
-int statbuf[STATBUFSIZE]; /* display statistics here */
-char answer[100]; /* human farts here */
-char *hashtable[TABLES]; /* we test many hash tables at once */
-char *h; /* points to curent hash_control */
+/* We test many hash tables at once. */
+char *hashtable[TABLES];
+
+/* Points to curent hash_control. */
+char *h;
char **pp;
char *p;
char *name;
char **pp;
char *p;
char *name;
@@
-430,8
+439,9
@@
char *value;
int size;
int used;
char command;
int size;
int used;
char command;
-int number; /* number 0:TABLES-1 of current hashed */
- /* symbol table */
+
+/* Number 0:TABLES-1 of current hashed symbol table. */
+int number;
int
main ()
int
main ()
@@
-449,8
+459,7
@@
main ()
printf ("hash_test command: ");
gets (answer);
command = answer[0];
printf ("hash_test command: ");
gets (answer);
command = answer[0];
- if (isupper (command))
- command = tolower (command); /* ecch! */
+ command = TOLOWER (command); /* Ecch! */
switch (command)
{
case '#':
switch (command)
{
case '#':
@@
-460,8
+469,8
@@
main ()
case '?':
for (pp = hashtable; pp < hashtable + TABLES; pp++)
{
case '?':
for (pp = hashtable; pp < hashtable + TABLES; pp++)
{
- printf ("address of hash table #%d control block is %xx\n"
-
,
pp - hashtable, *pp);
+ printf ("address of hash table #%d control block is %xx\n"
,
+ pp - hashtable, *pp);
}
break;
case 'a':
}
break;
case 'a':
@@
-542,7
+551,7
@@
what (description)
printf (" %s : ", description);
gets (answer);
printf (" %s : ", description);
gets (answer);
- /*
will one day clean up answer here
*/
+ /*
Will one day clean up answer here.
*/
retval = malloc (strlen (answer) + 1);
if (!retval)
{
retval = malloc (strlen (answer) + 1);
if (!retval)
{
@@
-561,7
+570,6
@@
destroy (string, value)
free (value);
}
free (value);
}
-
void
applicatee (string, value)
char *string;
void
applicatee (string, value)
char *string;
@@
-570,11
+578,12
@@
applicatee (string, value)
printf ("%.20s-%.20s\n", string, value);
}
printf ("%.20s-%.20s\n", string, value);
}
+/* Determine number: what hash table to use.
+ Also determine h: points to hash_control. */
+
void
void
-whattable () /* determine number: what hash table to use */
- /* also determine h: points to hash_control */
+whattable ()
{
{
-
for (;;)
{
printf (" what hash table (%d:%d) ? ", 0, TABLES - 1);
for (;;)
{
printf (" what hash table (%d:%d) ? ", 0, TABLES - 1);
@@
-596,6
+605,4
@@
whattable () /* determine number: what hash table to use */
}
}
}
}
-#endif /* #ifdef TEST */
-
-/* end of hash.c */
+#endif /* TEST */
This page took
0.025242 seconds
and
4
git commands to generate.