Re: pg_avd

From: "Matthew T(dot) O'Connor" <matthew(at)zeut(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Neil Conway <neilc(at)samurai(dot)com>, PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: pg_avd
Date: 2003-02-18 18:39:51
Message-ID: 1045593591.12300.36.camel@zeutrh80
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

On Tue, 2003-02-18 at 10:07, Tom Lane wrote:
> Neil Conway <neilc(at)samurai(dot)com> writes:
> > Some minor nit-picking follows below. I tend to be a bit of a
> > style-nazi, don't mind me :-)
>
> > - the length argument to snprintf() includes the terminating NUL byte,
> > so code like pg_avd.c line 334 is off-by-one:
>
> > char buf[256];
> > /* ... */
> > snprintf(buf,255,"...");
>
> Actually the preferred coding of this is
>
> snprintf(buf, sizeof(buf), ...);
>
> which is both correct and impervious to subsequent alteration of the
> declared size of buf. I get antsy whenever I see a snprintf with a
> literal-constant size argument, because it's a mistake waiting to
> happen. Use sizeof() when you can, or at least a #define.

OK, I will make those changes in the next version along with all the
changes mentioned in the other emails I have received. I will try to
have it in the next two days or so.

Matthew

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2003-02-18 18:49:24 Re: pg_avd
Previous Message Matthew T. O'Connor 2003-02-18 18:38:33 Re: pg_avd