From: Paul Eggert Date: Sun, 19 Jun 2011 18:40:02 +0000 (-0700) Subject: * callproc.c (child_setup): Rewrite to avoid two strlen calls. X-Git-Tag: emacs-pretest-24.0.90~104^2~473^2~30 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=35016e9a4e2fe3b60cbadd94a1a2feaed8aa1484;p=emacs.git * callproc.c (child_setup): Rewrite to avoid two strlen calls. --- diff --git a/src/ChangeLog b/src/ChangeLog index b843dfc6965..bcf40a4e470 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-06-19 Paul Eggert + * callproc.c (child_setup): Rewrite to avoid two strlen calls. + * process.c (Fformat_network_address): Use EMACS_INT, not EMACS_UINT. We prefer signed integers, even for size calculations. diff --git a/src/callproc.c b/src/callproc.c index fae47b7a699..12621c90db5 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -1230,8 +1230,7 @@ child_setup (int in, int out, int err, register char **new_argv, int set_pgrp, L if (STRINGP (display)) { - int vlen = strlen ("DISPLAY=") + strlen (SSDATA (display)) + 1; - char *vdata = (char *) alloca (vlen); + char *vdata = (char *) alloca (sizeof "DISPLAY=" + SBYTES (display)); strcpy (vdata, "DISPLAY="); strcat (vdata, SSDATA (display)); new_env = add_env (env, new_env, vdata);