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

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Michael Paquier <michael(dot)paquier(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:18:26
Message-ID: CAHGQGwEVYAge_s+4p0ghKMCz9j1ht-XRgKy=E5o3koYGopWFLg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jul 1, 2015 at 8:16 PM, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
> On Wed, Jun 10, 2015 at 2:41 PM, Michael Paquier
> <michael(dot)paquier(at)gmail(dot)com> wrote:
>> Hi all,
>>
>> While looking at the code of pg_archivecleanup.c, I noticed that there
>> is some code present to detect if a given string has the format of a
>> WAL segment file name or of a backup file.
>> The recent commit 179cdd09 has introduced in xlog_internal.h a set of
>> macros to facilitate checks of pg_xlog's name format:
>> IsPartialXLogFileName(), IsXLogFileName() and IsTLHistoryFileName().
>>
>> And by looking at the code, there are some utilities where we could
>> make use of that, like pg_resetxlog, pg_archivecleanup and pg_standby.
>>
>> Attached is a small refactoring patch doing so for HEAD.
>
> Thanks for the patch!
>
> 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.
>
> -#define MAXFNAMELEN 64
> +#define MAXFNAMELEN 64
>
> Revert this unnecessary change.
>
> +/* 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.
>
> Comments?
>
> Regards,
>
> --
> Fujii Masao

Patch attached.

Regards,

--
Fujii Masao

Attachment Content-Type Size
xlog_macros_fujii.patch text/x-patch 10.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2015-07-01 11:58:30 Re: Expending the use of xlog_internal.h's macros
Previous Message Fujii Masao 2015-07-01 11:16:53 Re: Expending the use of xlog_internal.h's macros