| From: | Andreas Karlsson <andreas(at)proxel(dot)se> |
|---|---|
| To: | Amul Sul <sulamul(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Cleanup: Replace sscanf with strtol/strtoul in snapmgr |
| Date: | 2026-05-01 08:08:45 |
| Message-ID: | 0929a125-10b5-4be9-a0a1-ced2cf983392@proxel.se |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On 4/20/26 07:06, Amul Sul wrote:
> The attached patch replaces sscanf with strtol and strtoul in the
> ImportSnapshot helpers (parseIntFromText, parseXidFromText, and
> parseVxidFromText) to improve reliability and efficiency. By utilizing
> the end pointer, we can locate the next line without re-scanning the
> entire string.
>
> Additionally, this change aligns the snapshot code with the rest of
> the Postgres backend, which already favors these functions for safer
> parsing.
I personally prefer this safer and easier to verify parsing so from me
this is a +1. I also reviewed the patch and it is simple, looks like it
handles errors correctly and matches code we have in other parts of our
code so I am all for merging it in its current shape. It also preserves
the old behavior of ignoring random stuff at the end of each line, for
good and bad.
Looks good to me!
Andreas
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Richard Guo | 2026-05-01 08:25:13 | Re: Remove inner joins based on foreign keys |
| Previous Message | Nitin Motiani | 2026-05-01 08:01:42 | Re: Adding pg_dump flag for parallel export to pipes |