Re: Change atoi to strtol in same place - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Change atoi to strtol in same place
Date
Msg-id 20190724051627.GF14257@paquier.xyz
Whole thread Raw
In response to Re: Change atoi to strtol in same place  (David Rowley <david.rowley@2ndquadrant.com>)
Responses Re: Change atoi to strtol in same place
List pgsql-hackers
On Wed, Jul 24, 2019 at 04:57:42PM +1200, David Rowley wrote:
> I'd like to put my vote not to add this complex code to each option
> validation that requires an integer number. I'm not sure there
> currently is a home for it, but if there was, wouldn't it be better
> writing a function that takes a lower and upper bound and sets some
> output param with the value and returns a bool to indicate if it's
> within range or not?

Perhaps.  When I see this patch calling strtol basically only for 10
as base, this reminds me of Fabien Coelho's patch refactor all the
strtoint routines we have in the code:
https://commitfest.postgresql.org/23/2099/

The conclusion that we are reaching on the thread is to remove more
dependencies on strtol that we have in the code, and replace it with
our own, more performant wrappers.  This thread makes me wondering
that we had better wait before doing this move.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Change atoi to strtol in same place
Next
From: Michael Paquier
Date:
Subject: Re: On the stability of TAP tests for LDAP