[hackers] [sbase] No need to dynamically allocate *cmd[] || sin

From: <git_AT_suckless.org>
Date: Thu, 16 Jan 2014 12:53:24 +0100

commit 7969fcd2c20cd6b5ba01ee24f40a232a3e71c300
Author: sin <sin_AT_2f30.org>
Date: Thu Jan 16 11:51:19 2014 +0000

    No need to dynamically allocate *cmd[]

diff --git a/xargs.c b/xargs.c
index b70c158..102c225 100644
--- a/xargs.c
+++ b/xargs.c
_AT_@ -22,7 +22,7 @@ static char *poparg(void);
 static void waitchld(void);
 static void spawn(void);
 
-static char **cmd;
+static char *cmd[NARGS];
 static char *argb;
 static size_t argbsz;
 static size_t argbpos;
_AT_@ -61,10 +61,6 @@ main(int argc, char *argv[])
         /* Leave some room for environment variables */
         argmaxsz -= 4 * 1024;
 
- cmd = malloc(NARGS * sizeof(*cmd));
- if (!cmd)
- eprintf("malloc:");
-
         leftover = 0;
         do {
                 argsz = 0; i = 0;
_AT_@ -98,7 +94,6 @@ main(int argc, char *argv[])
         } while (arg);
 
         free(argb);
- free(cmd);
 
         return nerrors > 0 ? 123 : 0;
 }
Received on Thu Jan 16 2014 - 12:53:24 CET

This archive was generated by hypermail 2.3.0 : Thu Jan 16 2014 - 13:00:12 CET