From owner-cvs-all@FreeBSD.ORG Wed Jul 2 12:46:09 2003 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5363137B401; Wed, 2 Jul 2003 12:46:09 -0700 (PDT) Received: from cirb503493.alcatel.com.au (c20257.belrs2.nsw.optusnet.com.au [198.142.180.81]) by mx1.FreeBSD.org (Postfix) with ESMTP id A9EBF43FBD; Wed, 2 Jul 2003 12:46:07 -0700 (PDT) (envelope-from peterjeremy@optushome.com.au) Received: from cirb503493.alcatel.com.au (localhost.alcatel.com.au [127.0.0.1])h62Jk5Qv039343; Thu, 3 Jul 2003 05:46:05 +1000 (EST) (envelope-from jeremyp@cirb503493.alcatel.com.au) Received: (from jeremyp@localhost) by cirb503493.alcatel.com.au (8.12.8/8.12.8/Submit) id h62Jk3PI039342; Thu, 3 Jul 2003 05:46:03 +1000 (EST) Date: Thu, 3 Jul 2003 05:46:02 +1000 From: Peter Jeremy To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org Message-ID: <20030702194602.GB21606@cirb503493.alcatel.com.au> References: <200306280903.h5S936Em045685@repoman.freebsd.org> <20030628090418.GA30292@HAL9000.homeunix.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030628090418.GA30292@HAL9000.homeunix.com> User-Agent: Mutt/1.4.1i Subject: Re: cvs commit: src/lib/libc/stdio vfscanf.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jul 2003 19:46:09 -0000 On Sat, Jun 28, 2003 at 02:04:19AM -0700, David Schultz wrote: >On Sat, Jun 28, 2003, David Schultz wrote: >> Revamp scanf's floating-point-parsing algorithm to support >> [+|-]Inf, [+|-]NaN, nan(...), and hexidecimal FP constants. ... >The new code should correctly parse any well-formed floating point >number, but if you notice any problems, set (extern int) scanfdebug >to 1. This will cause scanf() to dump core if it notices that >strtod() disagrees with it about how long the number is. vfscanf() does numeric conversion by calling strtoX() functions as appropriate. One side-effect of this is that vfscanf() needs to replicate the number parsing code in the strtoX() functions to convert the incoming FILE* stream into a character array as needed by strtoX() functions. This conversion also results in the 512 character limit on numeric strings. It would seem cleaner to use a common underlying set of conversion functions, similar to strtoX() but taking taking a FILE* and a width instead of a char*. The strtoX() functions can hand-craft the FILE structure much as sscanf() does. Benefits: - Removal of functionally duplicated code (vfscanf.c:parsefloat() and CT_INT code in vfscanf()) - Removal of arbitrary(?) 512 char numeric conversion limit Disadvantages: - Additional effort to develop/maintain new code - Some additional overhead in the strtoX() functions to build the FILE structure. Comments? Peter