Re: refactoring - share str2*int64 functions

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: refactoring - share str2*int64 functions
Date: 2019-09-10 02:22:06
Message-ID: 20190910022206.GA1635@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Sep 09, 2019 at 03:17:38AM -0700, Andres Freund wrote:
> On 2019-09-09 14:28:14 +0900, Michael Paquier wrote:
>> @@ -80,7 +81,7 @@
>> #define READ_UINT64_FIELD(fldname) \
>> token = pg_strtok(&length); /* skip :fldname */ \
>> token = pg_strtok(&length); /* get field value */ \
>> - local_node->fldname = pg_strtouint64(token, NULL, 10)
>> + (void) pg_strtouint64(token, &local_node->fldname)
>
> Seems like these actually could just ought to use the error-checked
> variants. And I think it ought to change all of
> READ_{INT,UINT,LONG,UINT64,OID}_FIELD, rather than just redirecting one
> of them to the new routines.

Okay for these changes, except for READ_INT_FIELD where we have short
variables using it as well (for example StrategyNumber) so this
generates a justified warning. I think that a correct solution
here would be to add a new READ_SHORT_FIELD which uses pg_strtoint16.
I am not adding that for now.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message gc_11 2019-09-10 02:28:07 回复:Re: Does PostgreSQL support debian Linux on Arm CPU Platform?
Previous Message Amit Kapila 2019-09-10 02:21:08 Re: [HACKERS] [PATCH] pageinspect function to decode infomasks