NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/60953: FEATURE: libc should have search1/search1_r that take key equality and hash functions



>Number:         60953
>Category:       lib
>Synopsis:       FEATURE: libc should have search1/search1_r that take key equality and hash functions
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Nov 02 05:50:00 +0000 2026
>Originator:     Chris Hanson
>Release:        
>Organization:
N/A
>Environment:
N/A
>Description:
Neither hash table interface in libc (<db.h> or <search.h>) supports an equality comparator, requiring they always use memcmp or strcmp for equality comparisons. Also, the <search.h> hash table interface doesnâ??t provide a means for specifying the hash function to use for keys.

Since the keys for a <search.h> hash table are anll inserted, found, and removed via the hsearch/hsearch_r functions, it would make sense to provide the equality and hash comparison functions via argument to a hypothetical hsearch1/hsearch1_r.

It would also make sense to provide a â??void *contextâ?? parameter to such an hsearch1/hsearch1_r function, such that it gets passed to the key hash and equality functions when theyâ??re called, so they can share context with the caller without using a global variable.
>How-To-Repeat:
N/A
>Fix:
N/A




Home | Main Index | Thread Index | Old Index