[libdispatch-dev] Solaris portability, patch for internal.h, include strings.h for bzero in queue.c REVISED PATCH
Robert Watson
robert at fledge.watson.org
Tue Nov 10 03:53:04 PST 2009
On Mon, 9 Nov 2009, Joakim Johansson wrote:
> You are absolutely right, also for the POSIX case - from the source
> http://www.opengroup.org/onlinepubs/000095399/functions/bzero.html
>
> Revised patch attached.
And committed as r146.
Robert
>
> Thanks!
>
> Joakim
>
>
> Index: /home/jocke/gcd/trunk/src/queue.c
> ===================================================================
> --- /home/jocke/gcd/trunk/src/queue.c (revision 142)
> +++ /home/jocke/gcd/trunk/src/queue.c (working copy)
> @@ -1706,7 +1713,7 @@
>
> sysctl(mib, 2, _dispatch_build, &bufsz, NULL, 0);
> #else
> - bzero(_dispatch_build, sizeof(_dispatch_build));
> + memset(_dispatch_build, 0, sizeof(_dispatch_build));
> #endif
> }
>
>
>
> On 9 nov 2009, at 15.53, Jean-Daniel Dupas wrote:
>
>>
>> I'm with Paolo on this point.
>>
>> Unlike memset which is now a macro optimized to use __builtin functions
>> when possible (on Darwin), bzero remain a simple function and is not
>> available everywhere.
>>
>>
>> Le 9 nov. 2009 à 14:32, Joakim Johansson a écrit :
>>
>>> Ok, it was available on OS X as well and seems to be part of POSIX
>>> according to the OS X man page?
>>>
>>> -----
>>> HISTORY
>>> A bzero() function appeared in 4.3BSD. Its prototype existed previously
>>> in <string.h> before it was
>>> moved to <strings.h> for IEEE Std 1003.1-2001 (``POSIX.1'') compliance.
>>> -----
>>>
>>> Joakim
>>>
>>>
>>> On 9 nov 2009, at 14.16, Paolo Bonzini wrote:
>>>
>>>> On Mon, Nov 9, 2009 at 14:01, Joakim Johansson <jocke at tbricks.com> wrote:
>>>>> bzero() is used in queue.c and is available from strings.h, needs an
>>>>> include
>>>>> for it.
>>>>
>>>> Probably better to use memset instead. bzero is on its way to
>>>> obsoletion.
>>>>
>>>> Also, strings.h is SVR-ism and is not available on many platforms.
>>>>
>>>> Paolo
>>>
>>> _______________________________________________
>>> libdispatch-dev mailing list
>>> libdispatch-dev at lists.macosforge.org
>>> http://lists.macosforge.org/mailman/listinfo.cgi/libdispatch-dev
>>>
>>
>> -- Jean-Daniel
>>
>>
>>
>>
>
> _______________________________________________
> libdispatch-dev mailing list
> libdispatch-dev at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/libdispatch-dev
More information about the libdispatch-dev
mailing list