This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Your change to intl/localealias.c (read_alias_file)
- To: Richard Kenner <kenner at vlsi1 dot ultra dot nyu dot edu>
- Subject: Re: Your change to intl/localealias.c (read_alias_file)
- From: Zack Weinberg <zack at wolery dot cumb dot org>
- Date: Wed, 31 May 2000 14:35:44 -0700
- Cc: drepper at cygnus dot com, gcc-patches at gcc dot gnu dot org
- References: <10005312022.AA24945@vlsi1.ultra.nyu.edu>
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