public inbox for [email protected]  
help / color / mirror / Atom feed
From: Andreas Karlsson <[email protected]>
To: Amul Sul <[email protected]>
To: PostgreSQL Hackers <[email protected]>
Subject: Re: Cleanup: Replace sscanf with strtol/strtoul in snapmgr
Date: Fri, 1 May 2026 10:08:45 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAAJ_b97mG=6ybUYE8nQyDfKkhaxTCD8rE8s6L8efNmqHaUYNWQ@mail.gmail.com>
References: <CAAJ_b97mG=6ybUYE8nQyDfKkhaxTCD8rE8s6L8efNmqHaUYNWQ@mail.gmail.com>

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






view thread (5+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Cleanup: Replace sscanf with strtol/strtoul in snapmgr
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox