RPM Community Forums

Mailing List Message of <popt-devel>

Re: Allow equal after a short option

From: Wayne Davison <wayned@samba.org>
Date: Sun 09 Mar 2008 - 22:38:23 CET
Message-ID: <20080309213823.GA9986@herod.dreamhost.com>
On Sun, Mar 09, 2008 at 10:51:42AM -0400, Jeff Johnson wrote:
> Meanwhile, below is a rewrite of POPT_fprintf, essentially identical
> to the "man vsnprintf" example. See what you think ...

Looks good.  I did some tweaking based on this code.  The attached patch
changes what you checked-in to CVS.  See if you agree with these points:

1. If the system has vasprintf(), just use that (avoiding issues 2 & 3).

2. Always allocate one more byte than we need, just in case the system's
   vsprintf() has an off-by-one bug with the limit.

3. Moved the va_start() and va_end() calls back in the loop because I
   believe that the systems that needed a va_copy() in the old code
   won't like the reuse of "ap" without it.

Bonus question:  I didn't think older systems supported the idiom of
realloc(NULL, len) doing a malloc().  I didn't check to see if that
idiom is already used elsewhere in the popt code, though, so I just
left that alone.

I tested both sides of the HAVE_VASPRINTF code and this seems good to


Received on Sun Mar 9 22:38:37 2008
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.