Re: Change atoi to strtol in same place

From: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>
To: Joe Nelson <joe(at)begriffs(dot)com>
Cc: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, Surafel Temesgen <surafel3000(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Change atoi to strtol in same place
Date: 2019-07-24 04:57:42
Message-ID: CAKJS1f94kkuB_53LcEf0HF+uxMiTCk5FtLx9gSsXcCByUKMz1g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 24 Jul 2019 at 16:02, Joe Nelson <joe(at)begriffs(dot)com> wrote:
> > In general, I think it's a good idea to fix those places, but I wonder
> > if we need to change the error messages too.
>
> I'll leave that decision for the community to debate. I did, however,
> remove the newlines for the new error messages being passed to
> pg_log_error().

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?

--
David Rowley http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Paul A Jungwirth 2019-07-24 05:13:07 Re: range_agg
Previous Message Andres Freund 2019-07-24 04:54:21 Re: pg_basebackup delays closing of stdout