Message ID | CAFULd4YHE2++2ZJAg2+gxdT8tso=-4ha3VsGLYhaB3TBLoCXxg@mail.gmail.com |
---|---|
State | New |
Headers | show |
On Thu, Mar 13, 2014 at 3:36 AM, Uros Bizjak <ubizjak@gmail.com> wrote: > > Attached patch changes the return value of the bzero macro to void, as > defined in a 4.3BSD: > > void bzero(void *s, size_t n); > > As an additional benefit, the changed macro now generates warning when > its return value is used (which is *not* the case in regex.c): I'm not worried about anybody using the return value incorrectly in this file. I think we should just # define bzero(s, n) memset (s, '\0', n) I'll approve that change if it works. Ian
On 03/13/2014 10:36 AM, Uros Bizjak wrote:
> +# define bzero(s, n) (memset (s, '\0', n), (void) 0)
AFAICS, the comma operator was only needed because of the
intention to return 's'. If 's' is not be returned, then simply
# define bzero(s, n) ((void) memset (s, '\0', n))
should work.
On Thu, Mar 13, 2014 at 10:24 PM, Pedro Alves <palves@redhat.com> wrote: > On 03/13/2014 10:36 AM, Uros Bizjak wrote: >> +# define bzero(s, n) (memset (s, '\0', n), (void) 0) > > AFAICS, the comma operator was only needed because of the > intention to return 's'. If 's' is not be returned, then simply > > # define bzero(s, n) ((void) memset (s, '\0', n)) > > should work. I think that adding (void) is the best solution. I'll commit this version as soon as bootstrap ends. Thanks, Uros.
Index: regex.c =================================================================== --- regex.c (revision 208529) +++ regex.c (working copy) @@ -151,7 +151,7 @@ char *realloc (); # include <string.h> # ifndef bzero # ifndef _LIBC -# define bzero(s, n) (memset (s, '\0', n), (s)) +# define bzero(s, n) (memset (s, '\0', n), (void) 0) # else # define bzero(s, n) __bzero (s, n) # endif