From: Kim Phillips <kim.phillips@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] env: fix env var autocompletion
Date: Mon, 4 Apr 2011 20:17:45 -0500 [thread overview]
Message-ID: <20110404201745.3ffc30cb.kim.phillips@freescale.com> (raw)
commit 560d424b6d7cd4205b062ad95f1b104bd4f8bcc3 "env: re-add
support for auto-completion" fell short of its description -
the 'used' logic in hmatch_r was reversed - '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.
typing 'printenv tft' and hitting 'tab' now displays valid
choices for variable names.
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Cc: Mike Frysinger <vapier@gentoo.org>
---
lib/hashtable.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/hashtable.c b/lib/hashtable.c
index fcdb53c..92eaa38 100644
--- a/lib/hashtable.c
+++ b/lib/hashtable.c
@@ -209,7 +209,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
next reply other threads:[~2011-04-05 1:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-05 1:17 Kim Phillips [this message]
2011-04-05 1:53 ` [U-Boot] env: fix env var autocompletion Mike Frysinger
2011-04-05 4:44 ` Peter Barada
2011-04-05 17:14 ` [U-Boot] [PATCH v2] lib/hashtable: " Kim Phillips
2011-04-15 7:57 ` Mike Frysinger
2011-04-27 22:55 ` Wolfgang Denk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110404201745.3ffc30cb.kim.phillips@freescale.com \
--to=kim.phillips@freescale.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox