Re: pg_tablespace_databases

From: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andreas Pflug <pgadmin(at)pse-consulting(dot)de>, Joe Conway <mail(at)joeconway(dot)com>, PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: pg_tablespace_databases
Date: 2004-07-06 12:44:55
Message-ID: Pine.LNX.4.58.0407062243290.17092@linuxworld.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

On Tue, 6 Jul 2004, Bruce Momjian wrote:

> Tom Lane wrote:
> > Andreas Pflug <pgadmin(at)pse-consulting(dot)de> writes:
> > > Joe Conway wrote:
> > >> 2) This allocation size was a bit ambigous and I think based on a once
> > >> longer tablespace directory name:
> >
> > > This size calculation originated (copy/paste) from
> > > commands/tablespace.c,
> >
> > Yeah --- Bruce did not adjust the string length calculations when he
> > editorialized on the directory name. I'd been meaning to go back and
> > make them match.
> >
> > > should be clarified there too (and "pg_tblspc" is
> > > hardcoded in strings, could be extracted to a macro definition).
> >
> > [ shrug... ] The name is not going to change again. I have never cared
> > for the practice of writing strlen("foo") as if it were a compile-time
> > constant. But certainly it would be entirely pointless to define such a
> > macro and then use it in only one place.
>
> I think with gcc strlen("foo") is a compile-time constant. At least I
> remember that as a gcc optimization. What do you prefer?
> sizeof("foo")-1? Certainly +3 is poorly documented, no?

You're right about the gcc optimisation:

int i = strlen("foo");
8048304: c7 45 fc 03 00 00 00 movl $0x3,0xfffffffc(%ebp)

It does look messy thought. Can't this be cleared by a comment?

Thanks,

Gavin

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2004-07-06 13:19:24 Re: pg_tablespace_databases
Previous Message Bruce Momjian 2004-07-06 11:15:18 Re: pg_tablespace_databases