aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2021-09-07 21:23:19 +0100
committerRon Yorston <rmy@pobox.com>2021-09-08 07:58:14 +0100
commit12bc40da28f85cbe97673671f315f847f1dbbabf (patch)
treeda96e85b876fe73fc68d01796e0de9a8f3ab4ccc
parent462863e747da49d4feefb08f8fb81292a9ab722e (diff)
downloadbusybox-w32-12bc40da28f85cbe97673671f315f847f1dbbabf.tar.gz
busybox-w32-12bc40da28f85cbe97673671f315f847f1dbbabf.tar.bz2
busybox-w32-12bc40da28f85cbe97673671f315f847f1dbbabf.zip
ash: code shrink ps_cmd
The ps_cmd member of struct procstat isn't used in the WIN32 port. Remove references to it. Saves 80 bytes.
-rw-r--r--shell/ash.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/shell/ash.c b/shell/ash.c
index faf861583..508633689 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -4065,11 +4065,12 @@ unaliascmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
4065 */ 4065 */
4066struct procstat { 4066struct procstat {
4067 pid_t ps_pid; /* process id */ 4067 pid_t ps_pid; /* process id */
4068#if ENABLE_PLATFORM_MINGW32
4069 HANDLE ps_proc;
4070#endif
4071 int ps_status; /* last process status from wait() */ 4068 int ps_status; /* last process status from wait() */
4069#if !ENABLE_PLATFORM_MINGW32
4072 char *ps_cmd; /* text of command being run */ 4070 char *ps_cmd; /* text of command being run */
4071#else
4072 HANDLE ps_proc;
4073#endif
4073}; 4074};
4074 4075
4075struct job { 4076struct job {
@@ -4502,14 +4503,18 @@ getjob(const char *name, int getctl)
4502static void 4503static void
4503freejob(struct job *jp) 4504freejob(struct job *jp)
4504{ 4505{
4506#if !ENABLE_PLATFORM_MINGW32
4505 struct procstat *ps; 4507 struct procstat *ps;
4506 int i; 4508 int i;
4509#endif
4507 4510
4508 INT_OFF; 4511 INT_OFF;
4512#if !ENABLE_PLATFORM_MINGW32
4509 for (i = jp->nprocs, ps = jp->ps; --i >= 0; ps++) { 4513 for (i = jp->nprocs, ps = jp->ps; --i >= 0; ps++) {
4510 if (ps->ps_cmd != nullstr) 4514 if (ps->ps_cmd != nullstr)
4511 free(ps->ps_cmd); 4515 free(ps->ps_cmd);
4512 } 4516 }
4517#endif
4513 if (jp->ps != &jp->ps0) 4518 if (jp->ps != &jp->ps0)
4514 free(jp->ps); 4519 free(jp->ps);
4515 jp->used = 0; 4520 jp->used = 0;
@@ -5884,11 +5889,12 @@ forkparent(struct job *jp, union node *n, int mode, HANDLE proc)
5884 if (jp) { 5889 if (jp) {
5885 struct procstat *ps = &jp->ps[jp->nprocs++]; 5890 struct procstat *ps = &jp->ps[jp->nprocs++];
5886 ps->ps_pid = pid; 5891 ps->ps_pid = pid;
5887#if ENABLE_PLATFORM_MINGW32
5888 ps->ps_proc = proc;
5889#endif
5890 ps->ps_status = -1; 5892 ps->ps_status = -1;
5893#if !ENABLE_PLATFORM_MINGW32
5891 ps->ps_cmd = nullstr; 5894 ps->ps_cmd = nullstr;
5895#else
5896 ps->ps_proc = proc;
5897#endif
5892#if JOBS 5898#if JOBS
5893 if (doing_jobctl && n) 5899 if (doing_jobctl && n)
5894 ps->ps_cmd = commandtext(n); 5900 ps->ps_cmd = commandtext(n);