[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Add hash_contains function
From: |
Colin Watson |
Subject: |
[PATCH] Add hash_contains function |
Date: |
Sun, 14 Feb 2010 03:22:38 +0000 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
I looked at converting man-db to use Gnulib's hash implementation rather
than its own. One obstacle seems to be that there is one place where
man-db cares about the difference between a key not being in the hash at
all, and a key being in the hash but with a NULL value (in Perl syntax,
the difference between 'not exists $hash{$key}' and 'not defined
$hash{$key}'). I haven't spent much time looking at the relevant code
and so it may well be that it can be rewritten to avoid relying on this
distinction, but in general it does seem like a useful distinction to
draw; most high-level languages' built-in hash implementations allow you
to ask whether a key exists without testing the truth of its value.
The attached patch adds this feature.
Thanks,
--
Colin Watson address@hidden
gnulib.hash_contains.diff
Description: Text Data
- [PATCH] Add hash_contains function,
Colin Watson <=