Re: Change atoi to strtol in same place

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: joe(at)begriffs(dot)com
Cc: alvherre(at)2ndquadrant(dot)com, robertmhaas(at)gmail(dot)com, michael(at)paquier(dot)xyz, david(dot)rowley(at)2ndquadrant(dot)com, tomas(dot)vondra(at)2ndquadrant(dot)com, surafel3000(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Change atoi to strtol in same place
Date: 2019-10-01 10:32:08
Message-ID: 20191001.193208.264851337.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello.

At Sun, 29 Sep 2019 23:51:23 -0500, Joe Nelson <joe(at)begriffs(dot)com> wrote in <20190930045123(dot)GC68117(at)begriffs(dot)com>
> Alvaro Herrera wrote:
> > ... can we have a new patch?
>
> OK, I've attached v4. It works cleanly on 55282fa20f with
> str2int-16.patch applied. My patch won't compile without the other one
> applied too.
>
> Changed:
> [x] revert my changes in common/Makefile
> [x] rename arg_utils.[ch] to option.[ch]
> [x] update @pgfeutilsfiles in Mkvcbuild.pm
> [x] pgindent everything
> [x] get rid of atoi() in more utilities

Compiler complained as "INT_MAX undeclared" (gcc 7.3 / CentOS7.6).

> One question about how the utilities parse port numbers. I currently
> have it check that the value can be parsed as an integer, and that its
> range is within 1 .. (1<<16)-1. I wonder if the former restriction is
> (un)desirable, because ultimately getaddrinfo() takes a "service name
> description" for the port, which can be a name such as found in
> '/etc/services' as well as the string representation of a number. If
> desired, I *could* treat only range errors as a failure for ports, and
> allow integer parse errors.

We could do that, but perhaps no use for our usage. We are not
likely to use named ports other than 'postgres', if any.

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro Horiguchi 2019-10-01 10:46:21 Re: Change atoi to strtol in same place
Previous Message Amit Kapila 2019-10-01 10:12:08 Re: Proposal: Make use of C99 designated initialisers for nulls/values arrays