Re: Change atoi to strtol in same place

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: Change atoi to strtol in same place
Дата
Msg-id 20190910053553.GB11737@paquier.xyz
обсуждение исходный текст
Ответ на Re: Change atoi to strtol in same place  (Joe Nelson <joe@begriffs.com>)
Ответы Re: Change atoi to strtol in same place  (Robert Haas <robertmhaas@gmail.com>)
Re: Change atoi to strtol in same place  (Joe Nelson <joe@begriffs.com>)
Список pgsql-hackers
On Mon, Sep 09, 2019 at 11:02:49PM -0500, Joe Nelson wrote:
> Alvaro Herrera from 2ndQuadrant wrote:
> > Okay, so who is submitting a new version here?  Surafel, Joe?
>
> I've attached a revision that uses pg_strtoint64 from str2int-10.patch
> (posted in <alpine.DEB.2.21.1909032007230.21690@lancre>). My patch is
> based off that one and c5bc7050af.
>
> It covers the same front-end utilities as atoi-to-strtol-v2.patch. Other
> utilities in the pg codebase still have atoi inside, but I thought I'd
> share my progress to see if people like the direction. If so, I can
> update the rest of the utils.
>
> I added a helper function to a new file in src/fe_utils, but had to
> modify Makefiles in ways that might not be too clean. Maybe there's a
> better place for the function.

Using a wrapper in src/fe_utils makes sense.  I would have used
options.c for the new file, or would that be too much generic?

The code indentation is weird, particularly the switch/case in
pg_strtoint64_range().

The error handling is awkward.  I think that you should just call
pg_log_error in pg_strtoint64_range instead of returning an error
string as you do.  You could do that by passing down the option name
to the routine, and generate a new set of error messages using that.

Why do you need to update common/Makefile?

The builds on Windows are broken.  You are adding one file into
fe_utils, but forgot to update @pgfeutilsfiles in Mkvcbuild.pm.
--
Michael

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: PostgreSQL 12 Beta 4
Следующее
От: Amit Kapila
Дата:
Сообщение: Re: pgbench - allow to create partitioned tables