[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: stat signed/unsigned
From: |
Jim Meyering |
Subject: |
Re: stat signed/unsigned |
Date: |
Fri, 16 Jan 2009 11:30:53 +0100 |
Pádraig Brady <address@hidden> wrote:
> I've split up my "avoid -Wsign-compare warnings" patch,
> like Jim originally requested.
>
> Attached are IMHO the non contentious patches.
>
> The rest which I'll drop for the moment all boil
> down to passing unsigned ints as field widths to
> printf, and treating stat.st_size as unsigned.
Hi Pádraig!
>>From c91df53022c168f84f70364465f58e434794b172 Mon Sep 17 00:00:00 2001
> From: =?utf-8?q?P=C3=A1draig=20Brady?= <address@hidden>
> Date: Wed, 14 Jan 2009 19:17:39 +0000
> Subject: [PATCH] simplify mgetgroups() and avoid -Wsign-compare warnings
>
> * gl/lib/mgetgroups.c: Don't explicitly call memcpy() or malloc()
> and also avoid -Wsign-compare warning by using appropriate
> types for the parameters of realloc_groupbuf().
The changes to the two files below are fine.
> * src/group-list.c: Use int rather than size_t as variable is
> used in signed comparisons.
> * src/id.c: ditto.
But while the mgetgroups.c changes seem fine,
they deserve a longer note in the log. And it should
mention that this is not just about warning-avoidance.
A minor disadvantage is that with your change, mgetgroups
always calls realloc_groupbuf twice, whereas before, it'd
usually perform only one malloc call. That micro-pessimization
is probably outweighed by your code-size reduction.
Also, please humor me and undo this change:
> - if (0 <= ng)
...
> + if (ng >= 0)
So, it's ok to commit that separately, but with a more detailed log.
I notice that your shred change does something similar,
but don't mind if you leave that one as-is.
The rest are fine, too.
Thanks!
- Re: stat signed/unsigned, (continued)
- Re: stat signed/unsigned, Jim Meyering, 2009/01/02
- Re: stat signed/unsigned, Michael Meskes, 2009/01/02
- Re: stat signed/unsigned, Pádraig Brady, 2009/01/06
- Re: stat signed/unsigned, Jim Meyering, 2009/01/06
- Re: stat signed/unsigned, Pádraig Brady, 2009/01/06
- Re: stat signed/unsigned, Jim Meyering, 2009/01/06
- Re: stat signed/unsigned, Pádraig Brady, 2009/01/07
- Re: stat signed/unsigned, Paul Eggert, 2009/01/08
- Re: stat signed/unsigned, Pádraig Brady, 2009/01/09
- Re: stat signed/unsigned, Pádraig Brady, 2009/01/15
- Re: stat signed/unsigned,
Jim Meyering <=
- Re: stat signed/unsigned, Pádraig Brady, 2009/01/16