aboutsummaryrefslogtreecommitdiff
path: root/opcodes/cgen-opc.c
diff options
context:
space:
mode:
authorGeoffrey Keating <geoffk@geoffk.org>2001-06-14 20:38:42 +0000
committerGeoffrey Keating <geoffk@geoffk.org>2001-06-14 20:38:42 +0000
commit3e890047742a6c96a421700d536a260bcc12a8ec (patch)
tree6a73e43d1c2f06a4da203cf548b85dc95e212984 /opcodes/cgen-opc.c
parentdc8acb9740b89a3bd10511e53dbf24ad25e1c048 (diff)
downloadgdb-3e890047742a6c96a421700d536a260bcc12a8ec.zip
gdb-3e890047742a6c96a421700d536a260bcc12a8ec.tar.gz
gdb-3e890047742a6c96a421700d536a260bcc12a8ec.tar.bz2
Index: opcodes/ChangeLog
2001-06-13 Geoffrey Keating <geoffk@redhat.com> * cgen-asm.c (cgen_parse_keyword): When looking for the boundaries of a keyword, allow any special characters that are actually in one of the allowed keyword. * cgen-opc.c (cgen_keyword_add): Add any special characters to the nonalpha_chars field. Index: cgen/ChangeLog 2001-06-13 Geoffrey Keating <geoffk@redhat.com> * desc.scm (<keyword> 'gen-defn): Add extra zero into CGEN_KEYWORD_ENTRY initializers. Index: include/opcode/ChangeLog 2001-06-13 Geoffrey Keating <geoffk@redhat.com> * cgen.h (cgen_keyword): Add nonalpha_chars field.
Diffstat (limited to 'opcodes/cgen-opc.c')
-rw-r--r--opcodes/cgen-opc.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/opcodes/cgen-opc.c b/opcodes/cgen-opc.c
index 7e958e7..f159943 100644
--- a/opcodes/cgen-opc.c
+++ b/opcodes/cgen-opc.c
@@ -118,6 +118,7 @@ cgen_keyword_add (kt, ke)
CGEN_KEYWORD_ENTRY *ke;
{
unsigned int hash;
+ size_t i;
if (kt->name_hash_table == NULL)
build_keyword_hash_tables (kt);
@@ -132,6 +133,21 @@ cgen_keyword_add (kt, ke)
if (ke->name[0] == 0)
kt->null_entry = ke;
+
+ for (i = 0; i < strlen (ke->name); i++)
+ if (! isalnum ((unsigned char) ke->name[i])
+ && ! strchr (kt->nonalpha_chars, ke->name[i]))
+ {
+ size_t idx = strlen (kt->nonalpha_chars);
+
+ /* If you hit this limit, please don't just
+ increase the size of the field, instead
+ look for a better algorithm. */
+ if (idx >= sizeof (kt->nonalpha_chars) - 1)
+ abort ();
+ kt->nonalpha_chars[idx] = ke->name[i];
+ kt->nonalpha_chars[idx+1] = 0;
+ }
}
/* FIXME: Need function to return count of keywords. */