Fix inappropriate uses of atol()

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Fix inappropriate uses of atol()
Date: 2024-08-03 11:04:04
Message-ID: a52738ad-06bc-4d45-b59f-b38a8a89de49@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I noticed (during [0]) to some uses of the function atol() seem
inappropriate. Either they assume that sizeof(long)==8 and so might
truncate data if not, or they are gratuitous because the surrounding
code does not use the long type. This patch fixes these, by using
atoll() or atoi() instead. (There are still some atol() calls left
after this, which seemed ok to me.)

In the past, Windows didn't have atoll(), but the online documentation
appears to indicate that this now works in VS 2015 and later, which is
what we support at the moment. The Cirrus CI passes.

[0]:
https://www.postgresql.org/message-id/flat/5d216d1c-91f6-4cbe-95e2-b4cbd930520c(at)ewie(dot)name

Attachment Content-Type Size
0001-Fix-inappropriate-uses-of-atol.patch text/plain 4.0 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2024-08-03 11:30:08 Re: Official devcontainer config
Previous Message Andreas Karlsson 2024-08-03 09:25:34 Re: WIP: parallel GiST index builds