From owner-freebsd-audit Sat Jun 16 1:10:21 2001 Delivered-To: freebsd-audit@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id E825237B403; Sat, 16 Jun 2001 01:10:17 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id SAA16842; Sat, 16 Jun 2001 18:10:14 +1000 Date: Sat, 16 Jun 2001 18:08:24 +1000 (EST) From: Bruce Evans X-Sender: bde@besplex.bde.org To: Assar Westerlund Cc: freebsd-audit@FreeBSD.ORG Subject: Re: *printf simplifications? In-Reply-To: <5lelslx9af.fsf@assaris.sics.se> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > 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