From: Jonathan McDowell <noodles@earth.li>
Date: Tue, 22 Jul 2014 11:59:32 +0000 (+0100)
Subject: Cleanup key array logic to make llvm scan-build happier
X-Git-Tag: onak-0.4.3~10
X-Git-Url: https://the.earth.li/gitweb/?a=commitdiff_plain;h=5e40e676a7c4f640c9f850a379300c01a5fca69c;p=onak.git

Cleanup key array logic to make llvm scan-build happier

We can't have the size != 0 without keys != NULL, but the fact we
checked one at the start and the other later was confusing the static
checks from scan-build. Use size in both places; it keeps scan-build
happy and make the code a little easier to read.
---

diff --git a/keyarray.c b/keyarray.c
index 8bade8c..8293392 100644
--- a/keyarray.c
+++ b/keyarray.c
@@ -71,7 +71,7 @@ bool array_add(struct keyarray *array, struct openpgp_fingerprint *fp)
 	int  curpos = 0;
 
 	found = false;
-	if (array->keys != NULL && array->count > 0) {
+	if (array->size != 0 && array->count > 0) {
 		bottom = -1;
 		top = array->count - 1;
 		while ((top - bottom) > 1) {