summaryrefslogtreecommitdiff
path: root/Build
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
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')
-rw-r--r--Build/source/texk/web2c/lib/ChangeLog4
-rw-r--r--Build/source/texk/web2c/lib/texmfmp.c27
-rw-r--r--Build/source/texk/web2c/luatexdir/ChangeLog4
-rw-r--r--Build/source/texk/web2c/luatexdir/luatex.c27
4 files changed, 26 insertions, 36 deletions
diff --git a/Build/source/texk/web2c/lib/ChangeLog b/Build/source/texk/web2c/lib/ChangeLog
index f136acf85c0..a1572f07224 100644
--- a/Build/source/texk/web2c/lib/ChangeLog
+++ b/Build/source/texk/web2c/lib/ChangeLog
@@ -1,3 +1,7 @@
+2013-01-18 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * texmfmp.c (mk_shellcmdlist): Simplify.
+
2013-01-06 Khaled Hosny <khaledhosny@eglug.org>
* texmfmp.c [XeTeX]: Support input pipes.
diff --git a/Build/source/texk/web2c/lib/texmfmp.c b/Build/source/texk/web2c/lib/texmfmp.c
index e4779a6f08c..47d52321930 100644
--- a/Build/source/texk/web2c/lib/texmfmp.c
+++ b/Build/source/texk/web2c/lib/texmfmp.c
@@ -209,40 +209,31 @@ mk_shellcmdlist (char *v)
{
char **p;
char *q, *r;
- 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 = xmalloc ((n + 1) * sizeof (char *));
+ cmdlist = xmalloc (n * sizeof (char *));
p = cmdlist;
q = v;
while ((r = strchr (q, ',')) != 0) {
*r = '\0';
- *p = xmalloc (strlen (q) + 1);
- strcpy (*p, q);
- *r = ',';
- r++;
- q = r;
- p++;
+ *p++ = xstrdup (q);
+ q = r + 1;
}
- if (*q) {
- *p = xmalloc (strlen (q) + 1);
- strcpy (*p, q);
- p++;
- *p = NULL;
- } else
- *p = NULL;
+ if (*q)
+ *p++ = xstrdup (q);
+ *p = NULL;
}
static void
diff --git a/Build/source/texk/web2c/luatexdir/ChangeLog b/Build/source/texk/web2c/luatexdir/ChangeLog
index 934674a8ae8..d3004c7a889 100644
--- a/Build/source/texk/web2c/luatexdir/ChangeLog
+++ b/Build/source/texk/web2c/luatexdir/ChangeLog
@@ -1,3 +1,7 @@
+2013-01-18 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * luatex.c (mk_shellcmdlist): Simplify (sync with texmfmp.c).
+
2013-01-10 Peter Breitenlohner <peb@mppmu.mpg.de>
* pdf/pdfgen.w (write_stream_length): Cast length for printing.
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