# HG changeset patch # User Rob Landley # Date 1329626651 21600 # Node ID f558dce66095ef9c5e63bd149e5fcfeefcf1047c # Parent 1a7110479d490943d707605dccd345ac2d3c97f2 Nathan McSween convinced me compilers that inline memset() can optimize the bzero case pretty well. diff -r 1a7110479d49 -r f558dce66095 lib/args.c --- a/lib/args.c Sat Feb 18 18:54:30 2012 -0600 +++ b/lib/args.c Sat Feb 18 22:44:11 2012 -0600 @@ -181,7 +181,7 @@ int i; // Parse option format string - bzero(gof, sizeof(struct getoptflagstate)); + memset(gof, 0, sizeof(struct getoptflagstate)); gof->maxargs = INT_MAX; if (!options) return; diff -r 1a7110479d49 -r f558dce66095 lib/lib.c --- a/lib/lib.c Sat Feb 18 18:54:30 2012 -0600 +++ b/lib/lib.c Sat Feb 18 22:44:11 2012 -0600 @@ -91,7 +91,7 @@ void *xzalloc(size_t size) { void *ret = xmalloc(size); - bzero(ret, size); + memset(ret, 0, size); return ret; } diff -r 1a7110479d49 -r f558dce66095 main.c --- a/main.c Sat Feb 18 18:54:30 2012 -0600 +++ b/main.c Sat Feb 18 22:44:11 2012 -0600 @@ -84,7 +84,7 @@ // Free old toys contents (to be reentrant) if (toys.optargs != toys.argv+1) free(toys.optargs); - bzero(&toys, sizeof(struct toy_context)); + memset(&toys, 0, sizeof(struct toy_context)); toys.which = which; toys.argv = argv; diff -r 1a7110479d49 -r f558dce66095 toys/toysh.c --- a/toys/toysh.c Sat Feb 18 18:54:30 2012 -0600 +++ b/toys/toysh.c Sat Feb 18 22:44:11 2012 -0600 @@ -291,7 +291,7 @@ // This fakes lots of what toybox_main() does. memcpy(&temp, &toys, sizeof(struct toy_context)); - bzero(&toys, sizeof(struct toy_context)); + memset(&toys, 0, sizeof(struct toy_context)); toy_init(tl, cmd->argv); tl->toy_main(); cmd->pid = toys.exitval;