]> git.ipfire.org Git - thirdparty/util-linux.git/commit
c.h: avoid undefined behavior in SINT_MAX macro
authorThomas Weißschuh <thomas@t-8ch.de>
Thu, 12 Jan 2023 00:49:35 +0000 (00:49 +0000)
committerThomas Weißschuh <thomas@t-8ch.de>
Thu, 12 Jan 2023 00:49:35 +0000 (00:49 +0000)
commita9b89327746b7c5fbe0cedd8aee992de6580ca8a
treedf3dfb8a6932bf7faaa34a0ca2d24b9f129d5bac
parent3870b182b7b0d98f487e023cd0030c8acd2adc1e
c.h: avoid undefined behavior in SINT_MAX macro

The previous implementation relied on signed-integer overflow.
This is undefined behavior.

Instead use an implementation that only requires twos-complement
representation. This is what everybody uses anyways and it will be
required by C23.
include/c.h