[OPEN-ILS-DEV] Re: PATCH: bzero is deprecated and unnecessary
Scott McKellar
mck9 at swbell.net
Sun Sep 30 20:23:04 EDT 2007
--- Mike Rylander <mrylander at gmail.com> wrote:
> The macro, as created, differs from the suggested in that it does not
> create temp vars for s and n. The compiler was not at all happy
> about
> the void casting for some reason, so I just act on the buffer (s)
> passed.
Sorry, that was my mistake. In my original proposal, temp_s should
have been declared as char *, not void *. The memset works with a
void *, but the indexing on the next line doesn't -- you can't
dereference a void pointer.
I tested the revised version with a little Hello World program.
With the char * instead of a void * on the temporary, it compiled
and ran just fine.
That'll teach me not to post untested code. (Well, actually, it
probably won't.)
It's worth a little extra trouble to make the macro safer.
Scott McKellar
More information about the Open-ils-dev
mailing list