Solaris portability, patch for internal.h, include strings.h for bzero in queue.c
bzero() is used in queue.c and is available from strings.h, needs an include for it. As all includes seems aggregated into internal.h, I added it there rather than directly into queue.c to keep the style consistent. Joakim Index: /home/jocke/gcd/trunk/src/internal.h =================================================================== --- /home/jocke/gcd/trunk/src/internal.h (revision 142) +++ /home/jocke/gcd/trunk/src/internal.h (working copy) @@ -116,6 +119,7 @@ #include <string.h> #include <syslog.h> #include <unistd.h> +#include <strings.h> #define DISPATCH_NOINLINE __attribute__((noinline))
On Mon, Nov 9, 2009 at 14:01, Joakim Johansson <jocke@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
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@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
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@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@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/libdispatch-dev
-- Jean-Daniel
You are absolutely right, also for the POSIX case - from the source http://www.opengroup.org/onlinepubs/000095399/functions/bzero.html Revised patch attached. 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@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@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/libdispatch-dev
-- Jean-Daniel
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@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@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/libdispatch-dev
-- Jean-Daniel
_______________________________________________ libdispatch-dev mailing list libdispatch-dev@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/libdispatch-dev
participants (4)
-
Jean-Daniel Dupas
-
Joakim Johansson
-
Paolo Bonzini
-
Robert Watson