This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Your change to intl/localealias.c (read_alias_file)


On Wed, May 31, 2000 at 04:22:54PM -0400, Richard Kenner wrote:
>     So now explain, what the hell are you talking about?  The function
>     returns a void* which is exactly correct and is what the code assumes.
> 
> Well, it produced an error, but I admit that I now don't understand why ...

I bet this mess

#if defined HAVE_STRING_H || defined _LIBC
# ifndef _GNU_SOURCE
#  define _GNU_SOURCE   1
# endif
# include <string.h>
#else
# include <strings.h>
# ifndef memcpy
#  define memcpy(Dst, Src, Num) bcopy (Src, Dst, Num)
# endif
#endif

is erroneously #defining memcpy to bcopy.  Try zapping all that and
just including <string.h> unconditionally.  That won't do for a
permanent fix but it's a start.

And there's no good reason to use the value of memcpy in this code;

              map[nmap].alias = memcpy (&string_space[string_space_act],
                                        alias, alias_len);
              string_space_act += alias_len;

              map[nmap].value = memcpy (&string_space[string_space_act],
                                        value, value_len);
              string_space_act += value_len;

could perfectly well be written

	      { char *ptr = &string_space[string_space_act];
		memcpy (ptr, alias, alias_len);
		map[nmap].alias = ptr;
		ptr += alias_len;
		string_space_act += alias_len;

		memcpy (ptr, value, value_len);
		map[nmap].value = ptr;
		string_space_act += value_len;
	      }

zw

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]