diff options
author | pfg <pfg@FreeBSD.org> | 2014-05-10 22:27:01 +0000 |
---|---|---|
committer | pfg <pfg@FreeBSD.org> | 2014-05-10 22:27:01 +0000 |
commit | 1f446d8434a38afc2c90eca121d1e8b6b9690f9b (patch) | |
tree | 32e525280ad5e81183cfd5488c0e7e2e416aef57 /usr.bin | |
parent | 5891a2653708f23404c609211dcbb7df723e08a0 (diff) | |
download | FreeBSD-src-1f446d8434a38afc2c90eca121d1e8b6b9690f9b.zip FreeBSD-src-1f446d8434a38afc2c90eca121d1e8b6b9690f9b.tar.gz |
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
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/printf/printf.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/usr.bin/printf/printf.c b/usr.bin/printf/printf.c index ac122f7..055657f 100644 --- a/usr.bin/printf/printf.c +++ b/usr.bin/printf/printf.c @@ -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; |