From 0734c043f9c0bcefa1a259d26304a1ff69cacbf0 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Thu, 29 Mar 2018 14:48:16 +0100 Subject: 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. --- win32/process.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'win32') 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) { intptr_t ret; - ret = mingw_spawn_1(P_NOWAIT, argv[0], (char *const *)argv, environ); + ret = mingw_spawn_proc((const char **)argv); return ret == -1 ? -1 : GetProcessId((HANDLE)ret); } @@ -479,13 +479,12 @@ UNUSED_PARAM comm = applet_name; } else { - char *name, *value; + char name[32], *value; - name = xasprintf("BB_APPLET_%d", sp->pid); + sprintf(name, "BB_APPLET_%d", sp->pid); if ((value=getenv(name)) != NULL) { comm = value; } - free(name); } safe_strncpy(sp->comm, comm, COMM_LEN); return sp; -- cgit v1.2.3-55-g6feb