Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 Jun 2001 18:08:24 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Assar Westerlund <assar@FreeBSD.ORG>
Cc:        freebsd-audit@FreeBSD.ORG
Subject:   Re: *printf simplifications?
Message-ID:  <Pine.BSF.4.21.0106161749280.90941-100000@besplex.bde.org>
In-Reply-To: <5lelslx9af.fsf@assaris.sics.se>

next in thread | previous in thread | raw e-mail | index | archive | help
> On 16 Jun 2001, Assar Westerlund wrote:
> 
> > Any reason not to commit this?

> Index: vsprintf.c
> ===================================================================
> RCS file: /home/ncvs/src/lib/libc/stdio/vsprintf.c,v
> retrieving revision 1.8
> diff -u -w -r1.8 vsprintf.c
> --- vsprintf.c	2001/06/16 05:37:57	1.8
> +++ vsprintf.c	2001/06/16 05:45:30
> @@ -52,16 +52,5 @@
>  	const char *fmt;
>  	_BSD_VA_LIST_ ap;
>  {
> -	int ret;
> -	FILE f;
> -

Style bug: now there is no blank line after the (null) auto declarations.

> -	f._file = -1;
> -	f._flags = __SWR | __SSTR;
> -	f._bf._base = f._p = (unsigned char *)str;
> -	f._bf._size = f._w = INT_MAX;
> -	ret = __vfprintf(&f, fmt, ap);
> -	*f._p = 0;
> -	if (str == NULL)
> -		free(f._bf._base);
> -	return (ret);
> +	return (vsnprintf(str, INT_MAX, fmt, ap));
>  }

vsprintf() can't call vsnprintf() due to namespace issues (the former is
in C[89-94] but the latter is only in C99).

The current duplication of code for the other functions seems to be just a
micro-(opt|pess)imization.

Bruce


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-audit" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0106161749280.90941-100000>