diff options
author | Stefan Metzmacher <metze@samba.org> | 2013-11-20 09:58:09 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2014-05-16 17:21:04 +0200 |
commit | de822b58476093dc43c27577d2f7074541113cc5 (patch) | |
tree | 55808947c1214ca87ef1297523f4f4ac4758149d | |
parent | eb95fc8866dd1710b4cc2f4a4e1dc9867424def2 (diff) | |
download | samba-de822b58476093dc43c27577d2f7074541113cc5.tar.gz samba-de822b58476093dc43c27577d2f7074541113cc5.tar.xz samba-de822b58476093dc43c27577d2f7074541113cc5.zip |
talloc: fix compiler warning
This avoids the following warning when using:
CFLAGS="-O3 -g -fstrict-overflow -Wstrict-overflow=5"
../talloc.c: In Funktion »talloc_is_parent«:
../talloc.c:2658:21: Warnung: assuming signed overflow does not occur when
changing X +- C1 cmp C2 to X cmp C1 +- C2 [-Wstrict-overflow]
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r-- | lib/talloc/talloc.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/talloc/talloc.c b/lib/talloc/talloc.c index 3b8cb81df4a..fa56ea56780 100644 --- a/lib/talloc/talloc.c +++ b/lib/talloc/talloc.c @@ -2655,7 +2655,10 @@ static int _talloc_is_parent(const void *context, const void *ptr, int depth) } tc = talloc_chunk_from_ptr(context); - while (tc && depth > 0) { + while (tc) { + if (depth <= 0) { + return 0; + } if (TC_PTR_FROM_CHUNK(tc) == ptr) return 1; while (tc && tc->prev) tc = tc->prev; if (tc) { |