]> git.ipfire.org Git - thirdparty/glibc.git/commit
string/stratcliff.c: Replace int with size_t [BZ #21982]
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 23 Aug 2017 15:22:52 +0000 (08:22 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 23 Aug 2017 15:23:02 +0000 (08:23 -0700)
commit376b40a27a6783ea7f73ae577be320df66aeb36d
tree2d328eb18f248077aa5e8260e208c09a48054d16
parent2b0b9a1c85ea93a64e55bb369e79758195512fc2
string/stratcliff.c: Replace int with size_t [BZ #21982]

Fix GCC 7 errors when string/stratcliff.c is compiled with -O3:

stratcliff.c: In function ‘do_test’:
cc1: error: assuming signed overflow does not occur when assuming that (X - c) <= X is always true [-Werror=strict-overflow]

[BZ #21982]
* string/stratcliff.c (do_test): Declare size, nchars, inner,
middle and outer with size_t instead of int.  Repleace %d and
%Zd with %zu in printf.  Update "MAX (0, nchars - 128)" and
"MAX (outer, nchars - 64)" to support unsigned outer and
nchars.  Also exit loop when outer == 0.
ChangeLog
string/stratcliff.c