summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/luatexdir/luatex.c
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2013-01-18 12:02:40 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2013-01-18 12:02:40 +0000
commit83881755c0c8346dd450a2a3ffc2f446961d4497 (patch)
tree650271233979d332892f0e9879f4b2c6e4f9f286 /Build/source/texk/web2c/luatexdir/luatex.c
parent1edf6b64eb5ea6b65099076e92bccb6a90d2d88b (diff)
texk/web2c: Simplify mk_shellcmdlist()
git-svn-id: svn://tug.org/texlive/trunk@28861 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/luatex.c')
-rw-r--r--Build/source/texk/web2c/luatexdir/luatex.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/Build/source/texk/web2c/luatexdir/luatex.c b/Build/source/texk/web2c/luatexdir/luatex.c
index 2551c152a68..5451da1e177 100644
--- a/Build/source/texk/web2c/luatexdir/luatex.c
+++ b/Build/source/texk/web2c/luatexdir/luatex.c
@@ -109,40 +109,31 @@ void mk_shellcmdlist(char *v)
{
char **p;
char *q, *r;
- unsigned int n;
+ size_t n;
q = v;
- n = 0;
+ n = 1;
/* analyze the variable shell_escape_commands = foo,bar,...
spaces before and after (,) are not allowed. */
while ((r = strchr(q, ',')) != 0) {
n++;
- r++;
- q = r;
+ q = r + 1;
}
if (*q)
n++;
- cmdlist = (char **) xmalloc((unsigned) ((n + 1) * sizeof(char *)));
+ cmdlist = xmalloc(n * sizeof (char *));
p = cmdlist;
q = v;
while ((r = strchr(q, ',')) != 0) {
*r = '\0';
- *p = (char *) xmalloc((unsigned) strlen(q) + 1);
- strcpy(*p, q);
- *r = ',';
- r++;
- q = r;
- p++;
+ *p++ = xstrdup (q);
+ q = r + 1;
}
- if (*q) {
- *p = (char *) xmalloc((unsigned) strlen(q) + 1);
- strcpy(*p, q);
- p++;
- *p = NULL;
- } else
- *p = NULL;
+ if (*q)
+ *p++ = xstrdup (q);
+ *p = NULL;
}
/* Called from maininit. Not static because also called from