summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2013-01-10 17:11:17 +0000
committerRoland McGrath <roland@gnu.org>2013-01-10 17:11:17 +0000
commit4c665b71b1b907fcd4a7d56e10c310ace08addd9 (patch)
treec0fcd9ce159299b103c39c9f6f9ffc3c6debab38
parent861ea9c877f1c72383a4e7fba46531f7b5d638ea (diff)
downloadbinutils-gdb-4c665b71b1b907fcd4a7d56e10c310ace08addd9.tar.gz
gas/
* hash.c (hash_new_sized): Make it global. * hash.h: Declare it. * macro.c (define_macro): Use hash_new_sized instead of hash_new, pass a small size.
-rw-r--r--gas/ChangeLog7
-rw-r--r--gas/hash.c4
-rw-r--r--gas/hash.h3
-rw-r--r--gas/macro.c26
4 files changed, 24 insertions, 16 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index d8563c85387..57a376cdf89 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,10 @@
+2013-01-10 Roland McGrath <mcgrathr@google.com>
+
+ * hash.c (hash_new_sized): Make it global.
+ * hash.h: Declare it.
+ * macro.c (define_macro): Use hash_new_sized instead of hash_new,
+ pass a small size.
+
2013-01-10 Will Newton <will.newton@imgtec.com>
* Makefile.am: Add Meta.
diff --git a/gas/hash.c b/gas/hash.c
index a58c9489b6a..bae83867d51 100644
--- a/gas/hash.c
+++ b/gas/hash.c
@@ -1,6 +1,6 @@
/* hash.c -- gas hash table code
Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999,
- 2000, 2001, 2002, 2003, 2005, 2007, 2008, 2009, 2011
+ 2000, 2001, 2002, 2003, 2005, 2007, 2008, 2009, 2011, 2013
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -83,7 +83,7 @@ set_gas_hash_table_size (unsigned long size)
/* Create a hash table. This return a control block. */
-static struct hash_control *
+struct hash_control *
hash_new_sized (unsigned long size)
{
unsigned long alloc;
diff --git a/gas/hash.h b/gas/hash.h
index fac814ea06d..c7ea7b57c70 100644
--- a/gas/hash.h
+++ b/gas/hash.h
@@ -1,5 +1,5 @@
/* hash.h -- header file for gas hash table routines
- Copyright 1987, 1992, 1993, 1995, 1999, 2003, 2005, 2007, 2008
+ Copyright 1987, 1992, 1993, 1995, 1999, 2003, 2005, 2007, 2008, 2013
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -31,6 +31,7 @@ void set_gas_hash_table_size (unsigned long);
/* Create a hash table. This return a control block. */
extern struct hash_control *hash_new (void);
+extern struct hash_control *hash_new_sized (unsigned long);
/* Delete a hash table, freeing all allocated memory. */
diff --git a/gas/macro.c b/gas/macro.c
index b3e0fd00a95..75b9b7ef93e 100644
--- a/gas/macro.c
+++ b/gas/macro.c
@@ -1,6 +1,6 @@
/* macro.c - macro support for gas
Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
- 2004, 2005, 2006, 2007, 2008, 2011, 2012 Free Software Foundation, Inc.
+ 2004, 2005, 2006, 2007, 2008, 2011, 2012, 2013 Free Software Foundation, Inc.
Written by Steve and Judy Chamberlain of Cygnus Support,
sac@cygnus.com
@@ -574,9 +574,9 @@ do_formals (macro_entry *macro, size_t idx, sb *in)
formal_entry *formal = new_formal ();
/* Add a special NARG formal, which macro_expand will set to the
- number of arguments. */
+ number of arguments. */
/* The same MRI assemblers which treat '@' characters also use
- the name $NARG. At least until we find an exception. */
+ the name $NARG. At least until we find an exception. */
if (macro_strip_at)
name = "$NARG";
else
@@ -642,7 +642,7 @@ define_macro (size_t idx, sb *in, sb *label,
macro->formal_count = 0;
macro->formals = 0;
- macro->formal_hash = hash_new ();
+ macro->formal_hash = hash_new_sized (7);
idx = sb_skip_white (idx, in);
if (! buffer_and_nest ("MACRO", "ENDM", &macro->sub, get_line))
@@ -950,13 +950,13 @@ macro_expand_body (sb *in, sb *out, formal_entry *formals,
if (ptr == NULL)
{
/* FIXME: We should really return a warning string here,
- but we can't, because the == might be in the MRI
- comment field, and, since the nature of the MRI
- comment field depends upon the exact instruction
- being used, we don't have enough information here to
- figure out whether it is or not. Instead, we leave
- the == in place, which should cause a syntax error if
- it is not in a comment. */
+ but we can't, because the == might be in the MRI
+ comment field, and, since the nature of the MRI
+ comment field depends upon the exact instruction
+ being used, we don't have enough information here to
+ figure out whether it is or not. Instead, we leave
+ the == in place, which should cause a syntax error if
+ it is not in a comment. */
sb_add_char (out, '=');
sb_add_char (out, '=');
sb_add_sb (out, &t);
@@ -1023,7 +1023,7 @@ macro_expand (size_t idx, sb *in, macro_entry *m, sb *out)
if (macro_mri)
{
/* The macro may be called with an optional qualifier, which may
- be referred to in the macro body as \0. */
+ be referred to in the macro body as \0. */
if (idx < in->len && in->ptr[idx] == '.')
{
/* The Microtec assembler ignores this if followed by a white space.
@@ -1349,7 +1349,7 @@ expand_irp (int irpc, size_t idx, sb *in, sb *out, size_t (*get_line) (sb *))
if (irpc)
in_quotes = ! in_quotes;
-
+
nxt = sb_skip_white (idx + 1, in);
if (nxt >= in->len)
{