Re: Expending the use of xlog_internal.h's macros

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Expending the use of xlog_internal.h's macros
Date: 2015-07-01 11:58:30
Message-ID: CAB7nPqR30_6ZbGmX2g5v-ka1W19EVzGdXvubFGhmu0zyz+2U2A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jul 1, 2015 at 8:18 PM, Fujii Masao wrote:
> On Wed, Jul 1, 2015 at 8:16 PM, Fujii Masao wrote:
>> I updated the patch as follows. Patch attached.
>>
>> +#define XLogFileNameExtended(fname, tli, log, seg)
>>
>> Move this macro to xlog_internal.h because it's used both in
>> pg_standby and pg_archivecleanup. There seems no need to
>> define it independently.

OK for me.

>> -#define MAXFNAMELEN 64
>> +#define MAXFNAMELEN 64
>>
>> Revert this unnecessary change.

Yes, thanks.

>>
>> +/* Length of XLog file name */
>> +#define XLOG_DATA_FNAME_LEN 24
>>
>> Shorten the name of this macro variable, to XLOG_FNAME_LEN,
>> for more code readability.

Thanks. You have more talent for naming than I do.

>> Comments?

Just reading it again, I think that XLogFileNameById should use
MAXFNAMELEN, and that XLogFileName should call directly
XLogFileNameById as both are doing the same operation like in the
attached. It seems also safer to use MAXFNAMELEN instead of MAXPGPATH
for exclusiveCleanupFileName in pg_standby.c and pg_archivecleanup.c.
--
Michael

Attachment Content-Type Size
20150701_xlog_macros_v2.patch text/x-patch 9.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2015-07-01 12:24:08 Re: Unneeded NULL-pointer check in FreeSpaceMapTruncateRel
Previous Message Fujii Masao 2015-07-01 11:18:26 Re: Expending the use of xlog_internal.h's macros