From mboxrd@z Thu Jan 1 00:00:00 1970 From: Richard Henderson To: gas2@sourceware.cygnus.com Subject: type correctness tweek Date: Thu, 06 May 1999 19:50:00 -0000 Message-id: <19990506194959.A14761@cygnus.com> X-SW-Source: 1999/msg00100.html 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));