From: Kim Phillips Date: Tue, 5 Apr 2011 12:14:50 -0500 Subject: [U-Boot] [PATCH v2] lib/hashtable: fix env var autocompletion In-Reply-To: <4D9A9E41.9000901@logicpd.com> References: <20110404201745.3ffc30cb.kim.phillips@freescale.com> <201104042153.16448.vapier@gentoo.org> <4D9A9E41.9000901@logicpd.com> Message-ID: <20110405121450.099cb324.kim.phillips@freescale.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de commit c81c1222427f268d29ba999c82e2477c428e7bab "Fix hash table deletion to prevent lost entries" broke environment variable autocompletion by accidentally inverting the condition for 'used' in hmatch_r(). 'used' is 0 if the hash table entry is not used, or -1 if deleted. This patch makes hmatch_r actually match on valid ('used') entries, instead of skipping them and failing to match anything. Signed-off-by: Kim Phillips --- v2: fix commit message to point to correct source of failure lib/hashtable.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lib/hashtable.c b/lib/hashtable.c index 2788a65..19d5b15 100644 --- a/lib/hashtable.c +++ b/lib/hashtable.c @@ -232,7 +232,7 @@ int hmatch_r(const char *match, int last_idx, ENTRY ** retval, size_t key_len = strlen(match); for (idx = last_idx + 1; idx < htab->size; ++idx) { - if (htab->table[idx].used > 0) + if (htab->table[idx].used <= 0) continue; if (!strncmp(match, htab->table[idx].entry.key, key_len)) { *retval = &htab->table[idx].entry; -- 1.7.4.2.dirty