* type correctness tweek
@ 1999-05-06 19:50 Richard Henderson
0 siblings, 0 replies; only message in thread
From: Richard Henderson @ 1999-05-06 19:50 UTC (permalink / raw)
To: gas2
Gas won't build with the metrowerks compiler, because we passed
an unsigned char* to strcpy, which expects char*.
I took this opportunity to not do two passes across the string.
r~
* symbols.c (symbol_find_base): Use memcpy instead of strcpy.
Don't copy before downcaseing.
Index: symbols.c
===================================================================
RCS file: /cvs/binutils/binutils/gas/symbols.c,v
retrieving revision 1.1.1.1
diff -c -p -d -r1.1.1.1 symbols.c
*** symbols.c 1999/05/03 07:28:41 1.1.1.1
--- symbols.c 1999/05/07 02:46:34
*************** symbol_find_base (name, strip_underscore
*** 456,478 ****
#ifdef tc_canonicalize_symbol_name
{
char *copy;
! copy = (char *) alloca (strlen (name) + 1);
! strcpy (copy, name);
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);
}
return ((symbolS *) hash_find (sy_hash, name));
--- 456,485 ----
#ifdef tc_canonicalize_symbol_name
{
char *copy;
+ size_t len = strlen (name) + 1;
! copy = (char *) alloca (len);
! memcpy (copy, name, len);
name = tc_canonicalize_symbol_name (copy);
}
#endif
if (! symbols_case_sensitive)
{
! 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));
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1999-05-06 19:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-05-06 19:50 type correctness tweek Richard Henderson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).