Browse Source

idtree: Fix comparison is always false warning

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>
David Gibson 10 years ago
parent
commit
2b48199f33
1 changed files with 2 additions and 1 deletions
  1. 2 1
      ccan/idtree/idtree.c

+ 2 - 1
ccan/idtree/idtree.c

@@ -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));