Question about coding of free space map

From: Tatsuo Ishii <ishii(at)postgresql(dot)org>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Question about coding of free space map
Date: 2014-08-26 02:13:23
Message-ID: 20140826.111323.42915740668569590.t-ishii@sraoss.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

While looking into backend/storage/freespace/freespace.c, I noticed
that struct FSMAddress is passed to functions by value, rather than
reference. I thought our code practice is defining pointer to a struct
data and using the pointer for parameter passing etc.

typedef struct RelationData *Relation;

IMO freespace.c is better to follow the practice.

Maybe this has been allowed because:

typedef struct
{
int level; /* level */
int logpageno; /* page number within the level */
} FSMAddress;

the struct size is 4+4=8 byte, which is same as 64 bit pointer. Still
I think it's better to use pointer to the struct because someday we
may want to add new member to the struct.

Best regards,
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2014-08-26 02:19:32 Re: Hardening pg_upgrade
Previous Message Jeff Janes 2014-08-26 02:09:36 Re: postgresql latency & bgwriter not doing its job