Re: printTable API (was: Show INHERIT in \du)

From: "Brendan Jurd" <direvus(at)gmail(dot)com>
To: "Alvaro Herrera" <alvherre(at)commandprompt(dot)com>
Cc: pgsql-patches(at)postgresql(dot)org, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: printTable API (was: Show INHERIT in \du)
Date: 2008-04-17 08:48:42
Message-ID: 37ed240d0804170148l6a4951bah292480af233729a3@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thu, Apr 17, 2008 at 9:53 AM, Alvaro Herrera wrote:
>
> Well, consider that there are going to be 1 or 2 entries in the arrays
> in most cases anyway :-) Well, as far as footers go anyway ... I just
> realized that in all other cases it will certainly be the wrong thing to
> do :-) Still, perhaps a integer count is better?
>

I oscillated between using an integer and a pointer for ->header and
- ->cell while I was writing the code. In the end I went with pointer
simply because it makes the iterations nicer looking, and there's a
symmetry in having the "first item" and "last item" pointers be the
same type.

If there's some technical reason that integers would be better, I'll
all ears, but from an aesthetic/code readability perspective I like
the pointer.

> > Brendan Jurd escribió:
> > What is it about the extra fields that makes you unhappy?
>
> I don't know if "unnecessarity" is a word, but I hope you get what I
> mean :-)

Since the footers list is usually pretty short, you could make an
argument for dropping the "last footer" pointer and just iterating
through the list to find the last element every time you want to do
something with footers. And to do that, you'd have to declare a
temporary pointer inside the AddFooter function anyway, so you're not
getting rid of the pointer so much as making it slightly more
transient.

All that having been said, C isn't my native language. So if the
pointer is indeed wasteful I'm happy to cede to the wisdom of more
experienced C coders.

Cheers,
BJ
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.7 (GNU/Linux)
Comment: http://getfiregpg.org

iD8DBQFIBw7m5YBsbHkuyV0RAv4IAJ0cKrziZpNWkVV7LxFhlV/V5L0pJACfUtZ+
cVbcjL1e89j21JDZJBVdBqw=
=Nzr+
-----END PGP SIGNATURE-----

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2008-04-17 09:16:17 Re: Lessons from commit fest
Previous Message Martijn van Oosterhout 2008-04-17 08:31:56 Re: Lessons from commit fest

Browse pgsql-patches by date

  From Date Subject
Next Message Alvaro Herrera 2008-04-17 12:34:52 Re: Proposed patch - psql wraps at window width
Previous Message Heikki Linnakangas 2008-04-17 06:20:50 Re: Patch for Prevent pg_dump/pg_restore from being affected by statement_timeout