Outdated comment on scram_build_secret

Started by Matheus Alcantaraover 1 year ago2 messageshackers
Jump to latest
#1Matheus Alcantara
matheusssilv97@gmail.com

Hi,

The documentation for the iterations parameter on scram_build_secret say:
* If iterations is 0, default number of iterations is used.

But the body of the function have the following assert
Assert(iterations > 0);

Commit b577743000 introduced the assert and remove the if condition.
All usages of this function is using an iteration > 0, so I think that
is just a matter of updating the documentation? If that's the case the
attached patch does that.

--
Matheus Alcantara
EDB: https://www.enterprisedb.com

Attachments:

v1-0001-Fix-outdated-scram_build_secret-comment.patchtext/plain; charset=UTF-8; name=v1-0001-Fix-outdated-scram_build_secret-comment.patchDownload+1-3
#2Michael Paquier
michael@paquier.xyz
In reply to: Matheus Alcantara (#1)
Re: Outdated comment on scram_build_secret

On Mon, Dec 09, 2024 at 08:39:03PM -0300, Matheus Alcantara wrote:

Commit b577743000 introduced the assert and remove the if condition. All
usages of this function is using an iteration > 0, so I think that is just a
matter of updating the documentation? If that's the case the attached patch
does that.

Ah, good catch.

- * If iterations is 0, default number of iterations is used.  The result is
- * palloc'd or malloc'd, so caller is responsible for freeing it.
+ * The result is palloc'd or malloc'd, so caller is responsible for freeing it.

Removing the comment sounds like the right thing to do here. I'll go
do that in a bit down to v16.
--
Michael