aboutsummaryrefslogtreecommitdiff
path: root/gas/symbols.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>1999-05-06 19:52:29 +0000
committerRichard Henderson <rth@redhat.com>1999-05-06 19:52:29 +0000
commit03987ceda10cf6d46476f5bd53be660c018e7d12 (patch)
tree775e995e0bf583aeef4360576fe2fd376253ea18 /gas/symbols.c
parent7fafc0fd27df38ac432f5a06a4d477699a9c94ed (diff)
downloadgdb-03987ceda10cf6d46476f5bd53be660c018e7d12.zip
gdb-03987ceda10cf6d46476f5bd53be660c018e7d12.tar.gz
gdb-03987ceda10cf6d46476f5bd53be660c018e7d12.tar.bz2
* symbols.c (symbol_find_base): Use memcpy instead of strcpy.
Don't copy before downcaseing.
Diffstat (limited to 'gas/symbols.c')
-rw-r--r--gas/symbols.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/gas/symbols.c b/gas/symbols.c
index a1cde6a..8a05e1f 100644
--- a/gas/symbols.c
+++ b/gas/symbols.c
@@ -456,23 +456,30 @@ symbol_find_base (name, strip_underscore)
#ifdef tc_canonicalize_symbol_name
{
char *copy;
+ size_t len = strlen (name) + 1;
- copy = (char *) alloca (strlen (name) + 1);
- strcpy (copy, name);
+ copy = (char *) alloca (len);
+ memcpy (copy, name, len);
name = tc_canonicalize_symbol_name (copy);
}
#endif
if (! symbols_case_sensitive)
{
- unsigned char *copy;
-
- copy = (unsigned char *) alloca (strlen (name) + 1);
- strcpy (copy, name);
- name = (const char *) copy;
- for (; *copy != '\0'; copy++)
- if (islower (*copy))
- *copy = toupper (*copy);
+ char *copy;
+ const char *orig;
+ unsigned char c;
+
+ orig = name;
+ name = copy = (char *) alloca (strlen (name) + 1);
+
+ while ((c = *orig++) != '\0')
+ {
+ if (islower (c))
+ c = toupper (c);
+ *copy++ = c;
+ }
+ *copy = '\0';
}
return ((symbolS *) hash_find (sy_hash, name));