* symbols.c (symbol_find_base): Use memcpy instead of strcpy.

Don't copy before downcaseing.
This commit is contained in:
Richard Henderson 1999-05-06 19:52:29 +00:00
parent 7fafc0fd27
commit 03987ceda1
2 changed files with 21 additions and 9 deletions

View file

@ -1,3 +1,8 @@
Thu May 6 19:50:14 1999 Richard Henderson <rth@cygnus.com>
* symbols.c (symbol_find_base): Use memcpy instead of strcpy.
Don't copy before downcaseing.
1999-05-05 Catherine Moore <clm@cygnus.com>
* tc-m68k.c: Include elf/m68k.h.

View file

@ -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;
char *copy;
const char *orig;
unsigned char c;
copy = (unsigned char *) alloca (strlen (name) + 1);
strcpy (copy, name);
name = (const char *) copy;
for (; *copy != '\0'; copy++)
if (islower (*copy))
*copy = toupper (*copy);
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));