diff options
author | Ron Yorston <rmy@pobox.com> | 2018-03-29 14:48:16 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2018-03-29 14:48:16 +0100 |
commit | 0734c043f9c0bcefa1a259d26304a1ff69cacbf0 (patch) | |
tree | 17c8d368fffb062effb22202f8c3545ebd8bd3dc /win32 | |
parent | 9c8ff33cb536d02e5f8626e16b58cf4b231fb404 (diff) | |
download | busybox-w32-0734c043f9c0bcefa1a259d26304a1ff69cacbf0.tar.gz busybox-w32-0734c043f9c0bcefa1a259d26304a1ff69cacbf0.tar.bz2 busybox-w32-0734c043f9c0bcefa1a259d26304a1ff69cacbf0.zip |
win32: save a few bytes
In the recently-added code to pass applet names to child processes use
local arrays to build the environment variables rather that allocating
them every time.
mingw_spawn can call mingw_spawn_proc instead of mingw_spawn_1.
Diffstat (limited to 'win32')
-rw-r--r-- | win32/process.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/win32/process.c b/win32/process.c index 95508264b..de8f653c5 100644 --- a/win32/process.c +++ b/win32/process.c | |||
@@ -361,7 +361,7 @@ mingw_spawn(char **argv) | |||
361 | { | 361 | { |
362 | intptr_t ret; | 362 | intptr_t ret; |
363 | 363 | ||
364 | ret = mingw_spawn_1(P_NOWAIT, argv[0], (char *const *)argv, environ); | 364 | ret = mingw_spawn_proc((const char **)argv); |
365 | 365 | ||
366 | return ret == -1 ? -1 : GetProcessId((HANDLE)ret); | 366 | return ret == -1 ? -1 : GetProcessId((HANDLE)ret); |
367 | } | 367 | } |
@@ -479,13 +479,12 @@ UNUSED_PARAM | |||
479 | comm = applet_name; | 479 | comm = applet_name; |
480 | } | 480 | } |
481 | else { | 481 | else { |
482 | char *name, *value; | 482 | char name[32], *value; |
483 | 483 | ||
484 | name = xasprintf("BB_APPLET_%d", sp->pid); | 484 | sprintf(name, "BB_APPLET_%d", sp->pid); |
485 | if ((value=getenv(name)) != NULL) { | 485 | if ((value=getenv(name)) != NULL) { |
486 | comm = value; | 486 | comm = value; |
487 | } | 487 | } |
488 | free(name); | ||
489 | } | 488 | } |
490 | safe_strncpy(sp->comm, comm, COMM_LEN); | 489 | safe_strncpy(sp->comm, comm, COMM_LEN); |
491 | return sp; | 490 | return sp; |