[U-Boot] env: fix env var autocompletion

Peter Barada peter.barada at logicpd.com
Tue Apr 5 06:44:49 CEST 2011


> On Monday, April 04, 2011 21:17:45 Kim Phillips wrote:
>> 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.
> i dont think my commit is wrong.  i think the bug you describe was actually 
> added in c81c1222427f268d29ba999c82e2477c428e7bab.
You're right; I accidentally inverted the condition in my patch; it orignally was:

    if (!htab->table[idx].used)
        continue;

Since a deleted entry is now -1 (and an unused entry is zero), the condition should have been:

    if (htab->table[idx].used <= 0)
        continue;

not:

    if (htab->table[idx].used > 0)
        continue;
> -mike


-- 
Peter Barada
peter.barada at logicpd.com



More information about the U-Boot mailing list