From 2b54b1ab1a796ef89426f021319c11ff22710947 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sat, 18 Feb 2012 22:44:11 -0600 Subject: Nathan McSween convinced me compilers that inline memset() can optimize the bzero case pretty well. --- lib/args.c | 2 +- lib/lib.c | 2 +- main.c | 2 +- toys/toysh.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/args.c b/lib/args.c index 1b69466e..0ec20375 100644 --- a/lib/args.c +++ b/lib/args.c @@ -181,7 +181,7 @@ void parse_optflaglist(struct getoptflagstate *gof) 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 --git a/lib/lib.c b/lib/lib.c index 2c4361a8..ba6d132d 100644 --- a/lib/lib.c +++ b/lib/lib.c @@ -91,7 +91,7 @@ void *xmalloc(size_t size) void *xzalloc(size_t size) { void *ret = xmalloc(size); - bzero(ret, size); + memset(ret, 0, size); return ret; } diff --git a/main.c b/main.c index 0820e87b..1b1f0fcc 100644 --- a/main.c +++ b/main.c @@ -84,7 +84,7 @@ void toy_init(struct toy_list *which, char *argv[]) // 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 --git a/toys/toysh.c b/toys/toysh.c index b2dd2bba..23b88c3d 100644 --- a/toys/toysh.c +++ b/toys/toysh.c @@ -291,7 +291,7 @@ static void run_pipeline(struct pipeline *line) // 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; -- cgit v1.2.3