[PATCH] string/stratcliff.c: Replace int with size_t [BZ #21982]

H.J. Lu hjl.tools@gmail.com
Mon Aug 21 15:03:00 GMT 2017


On Mon, Aug 21, 2017 at 6:55 AM, Joseph Myers <joseph@codesourcery.com> wrote:
> On Mon, 21 Aug 2017, H.J. Lu wrote:
>
>> On Mon, Aug 21, 2017 at 6:23 AM, Joseph Myers <joseph@codesourcery.com> wrote:
>> > On Sun, 20 Aug 2017, H.J. Lu wrote:
>> >
>> >> @@ -101,7 +101,7 @@ do_test (void)
>> >>
>> >>             if (STRLEN (&adr[outer]) != (size_t) (inner - outer))
>> >>               {
>> >> -               printf ("%s flunked for outer = %d, inner = %d\n",
>> >> +               printf ("%s flunked for outer = %Zd, inner = %Zd\n",
>> >
>> > I don't think we should be using legacy %Z in any new code.  Use C99 %zu
>> > for size_t (%zd only if the argument is the corresponding signed type
>> > rather than size_t itself).
>> >
>>
>> There are some %Zd in string/stratcliff.c.  Should they be changed?
>> Since All of them are size_t, I will replace %Zd with %zu.
>
> In my view it makes sense to clean up existing uses of %Z legacy formats,
> provided there is still stdio test coverage that %Z behaves as expected.
>

Here is the updated patch.  OK for master?

Thanks.


-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-string-stratcliff.c-Replace-int-with-size_t-BZ-21982.patch
Type: text/x-patch
Size: 10226 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20170821/ffb254de/attachment.bin>


More information about the Libc-alpha mailing list