Date: Sat, 10 May 2014 22:27:02 +0000 (UTC) From: "Pedro F. Giffuni" <pfg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r265860 - head/usr.bin/printf Message-ID: <201405102227.s4AMR2Is079059@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: pfg Date: Sat May 10 22:27:01 2014 New Revision: 265860 URL: http://svnweb.freebsd.org/changeset/base/265860 Log: prinf: replace use of alloca with variable length array. Use of alloca(3) is discouraged in FreeBSD. Using a VLA is simple and should be more portable. Requested by: jilles Modified: head/usr.bin/printf/printf.c Modified: head/usr.bin/printf/printf.c ============================================================================== --- head/usr.bin/printf/printf.c Sat May 10 21:53:07 2014 (r265859) +++ head/usr.bin/printf/printf.c Sat May 10 22:27:01 2014 (r265860) @@ -215,13 +215,11 @@ printf_doformat(char *fmt, int *rval) static const char skip1[] = "#'-+ 0"; int fieldwidth, haveprec, havewidth, mod_ldbl, precision; char convch, nextch; - char *start; + char start[strlen(fmt) + 1]; char **fargv; char *dptr; int l; - start = alloca(strlen(fmt) + 1); - dptr = start; *dptr++ = '%'; *dptr = 0;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201405102227.s4AMR2Is079059>