]> git.ozlabs.org Git - ccan/commitdiff
idtree: Fix comparison is always false warning
authorDavid Gibson <david@gibson.dropbear.id.au>
Wed, 27 Jan 2016 13:14:19 +0000 (00:14 +1100)
committerDavid Gibson <david@gibson.dropbear.id.au>
Tue, 2 Feb 2016 12:00:06 +0000 (23:00 +1100)
idtree.c:146 triggers a "comparison is always false" warning on some
compiler configurations, since the 'id' variable is unsigned.

Elsewhere in the module ids seem to be represented by (signed) ints, so
use the same convention here, suppressing the warning and also maybe being
more correct in other ways.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
ccan/idtree/idtree.c

index e8873926a79c07a21b7b843f06b3b4cfaa7078c9..48add6a8ac4fa917751ac92a06709a730b9e0ba6 100644 (file)
@@ -100,7 +100,8 @@ static int sub_alloc(struct idtree *idp, const void *ptr, int *starting_id)
        int n, m, sh;
        struct idtree_layer *p, *pn;
        struct idtree_layer *pa[MAX_LEVEL+1];
-       unsigned int l, id, oid;
+       unsigned int l;
+       int id, oid;
        uint32_t bm;
 
        memset(pa, 0, sizeof(pa));