Re: fix typo in guc.c

From: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
To: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: fix typo in guc.c
Date: 2015-01-26 13:06:35
Message-ID: 54C63BDB.6090201@vmware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 01/26/2015 02:56 PM, Sawada Masahiko wrote:
> Hi,
>
> Attached patch fixes the typo in guc.c.
> It's typo, I think.
>
> diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
> index f6df077..f4f1965 100644
> --- a/src/backend/utils/misc/guc.c
> +++ b/src/backend/utils/misc/guc.c
> @@ -3880,7 +3880,7 @@ build_guc_variables(void)
> }
>
> /*
> - * Create table with 20% slack
> + * Create table with 25% slack
> */
> size_vars = num_vars + num_vars / 4;

No, I think that's intentional. After the creation, indeed 20% of the
table is empty. For example, if num_vars is 100, size_vars is 125. And
100/125 = 0.80.

In add_guc_variable, where the table is enlarged, it says:

> /*
> * Increase the vector by 25%
> */
> int size_vars = size_guc_variables + size_guc_variables / 4;

That's correct too. The table is enlarged by 25%, so after the
operation, 20% of it is again free. Subtle ;-)

(Although I don't think "increase" is the correct term here. Should be
"enlarge", or "increase the *size* of the vector by 25%".)

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Sawada Masahiko 2015-01-26 13:21:33 Re: fix typo in guc.c
Previous Message Marko Tiikkaja 2015-01-26 13:02:53 Re: PL/pgSQL, RAISE and error context