From owner-freebsd-audit Fri May 31 4:28:41 2002 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 8F88737B401 for ; Fri, 31 May 2002 04:28:37 -0700 (PDT) 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 VAA28324; Fri, 31 May 2002 21:28:25 +1000 Date: Fri, 31 May 2002 21:31:54 +1000 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Dag-Erling Smorgrav Cc: Dima Dorfman , Subject: Re: %j for printf(9) In-Reply-To: Message-ID: <20020531205803.L32389-100000@gamplex.bde.org> 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 31 May 2002, Dag-Erling Smorgrav wrote: > Bruce, does this look OK? > > fetch_nosign: > if (jflag) > num = va_arg(ap, uintmax_t); > else if (qflag) > num = va_arg(ap, u_quad_t); > else if (lflag) > num = va_arg(ap, u_long); > else > num = va_arg(ap, u_int); > goto nosign; > fetch_number: > if (jflag) > num = va_arg(ap, intmax_t); > else if (qflag) > num = sign ? (uintmax_t)va_arg(ap, quad_t) : > va_arg(ap, u_quad_t); > else if (lflag) > num = sign ? (uintmax_t)va_arg(ap, long) : > va_arg(ap, u_long); > else > num = sign ? (uintmax_t)va_arg(ap, int) : > va_arg(ap, u_int); > goto number; OK. I don't remember all the context for this. Is everything restructured so that all the va_arg()'s for fetching integers are in the above patch? If so, consider the following further restructurings: - merge fetch_nosign with nosign (rename it to something like handle_unsigned) and use it handle all the unsigned cases that are now handled by fetch_number. - rename fetch_number to handle_signed and use it for only the signed cases (%d and %+z). - don't bother explicitly casting to uintmax_t for the signed cases. In -current, these casts are used for %+z but not for %d. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message