Cleanup: Replace sscanf with strtol/strtoul in snapmgr
amul sul <sulamul@gmail.com>
From: Amul Sul <sulamul@gmail.com>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-04-20T05:06:21Z
Lists: pgsql-hackers
Attachments
- 0001-snapmgr-replace-sscanf-with-strtol-strtoul-in-snapsh.patch (application/x-patch) patch 0001
Hi, 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. -- Regards, Amul Sul EDB: http://www.enterprisedb.com