Re: [pgsql-hackers-win32] snprintf causes regression tests - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: [pgsql-hackers-win32] snprintf causes regression tests
Date
Msg-id 200503141855.j2EItGp11936@candle.pha.pa.us
Whole thread Raw
In response to Re: [pgsql-hackers-win32] snprintf causes regression tests to fail  (Nicolai Tufar <ntufar@gmail.com>)
Responses Re: [pgsql-hackers-win32] snprintf causes regression tests to fail
List pgsql-hackers
Nicolai Tufar wrote:
> On Thu, 10 Mar 2005 19:21:41 -0500 (EST), Bruce Momjian
> <pgman@candle.pha.pa.us> wrote:
> > > The CVS-tip implementation is fundamentally broken and won't work even
> > > for our internal uses.  I've not wasted time complaining about it
> > > because I thought we were going to replace it.  If we can't find a
> > > usable replacement then we're going to have to put a lot of effort
> > > into fixing what's there.  On the whole I think the effort would be
> > > better spent importing someone else's solution.
> >
> > Oh, so our existing implementation doesn't even meet our needs. OK.

(Your new patch is in the queue.)

I have been thinking about our current snprintf() implementation.  As I
remember, we use snprintf mostly for an snprintf that doesn't support
long long, and now those that don't support %$.  I am wondering if we
should just process long long args and %$ args, and pass everything else
to the native snprintf.

In fact, one trick would be to substitute long long and %$ in the printf
format string, and then pass that to the native libc printf, with
adjustments for the printf format arguments.  That might be simpler than
emulating all of snprintf.

FYI, now that we are using pg_snprintf macros the native snprintf is
available to us.

Anyway, I am sure there are some platforms that don't have vsnprint or
snprintf, but could we just say we don't support them, or emulate one of
we only have the other?

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

pgsql-hackers by date:

Previous
From: Greg Stark
Date:
Subject: Re: invalidating cached plans
Next
From: Tom Lane
Date:
Subject: Re: [pgsql-hackers-win32] snprintf causes regression tests to fail