Re: Cleanup: Replace sscanf with strtol/strtoul in snapmgr

Поиск
Список
Период
Сортировка
От Andreas Karlsson
Тема Re: Cleanup: Replace sscanf with strtol/strtoul in snapmgr
Дата
Msg-id 0929a125-10b5-4be9-a0a1-ced2cf983392@proxel.se
обсуждение
Ответ на Cleanup: Replace sscanf with strtol/strtoul in snapmgr  (Amul Sul <sulamul@gmail.com>)
Список 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




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