]> git.ipfire.org Git - thirdparty/git.git/commit
reftable/basics: stop using `st_mult()` in array allocators
authorPatrick Steinhardt <ps@pks.im>
Tue, 18 Feb 2025 09:20:44 +0000 (10:20 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 18 Feb 2025 18:55:37 +0000 (10:55 -0800)
commit6e3ea71639a3541523f2be8f950325c8a0aa6768
treed0e848e9c47e0de543bf76399f804d8ffe1fd296
parent445f9f4f35c663fb668425f8c8fe0a1d58e1d8c7
reftable/basics: stop using `st_mult()` in array allocators

We're using `st_mult()` as part of our macro helpers that allocate
arrays. This is bad due two two reasons:

  - `st_mult()` causes us to die in case the multiplication overflows.

  - `st_mult()` ties us to the Git codebase.

Refactor the code to instead detect overflows manually and return an
error in such cases.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
reftable/basics.h