FreeBSD Manual Pages
HASH CONVENIENCES(3) BSD Library Functions Manual HASH CONVENIENCES(3) NAME hash_compare_int, hash_compare_string, hash_hash_int, hash_hash_string, hash_copy_int, hash_copy_string -- libhash convenience functions LIBRARY Hash Library (libhash, -lhash) SYNOPSIS #include <sys/types.h> #include <hash.h> int hash_compare_int(void *key1, void *key2); int hash_compare_string(void *key1, void *key2); u_int32_t hash_hash_int(void *key, u_int32_t number_of_buckets); u_int32_t hash_hash_string(void *key, u_int32_t number_of_buckets); int hash_copy_int(void **destination, void *source); int hash_copy_string(void **destination, void *source); DESCRIPTION These functions are provided by libhash as a convenience for users. They are all designed to be passed to hash_initialise() as one of the parame- ters. The functions hash_compare_int() and hash_compare_string() are designed to be passed to hash_initialise() as the compare_keys argument. hash_compare_int() works with keys that are integers and hash_compare_string() works with keys that are nul terminated char arrays (strings). hash_compare_string() performs a case sensistive lexicograph- ical comparison. The functions hash_hash_int() and hash_hash_string() are designed to be passed to hash_initialise() as the hash_function argument. hash_hash_int() works with keys that are integers and hash_hash_string() works with keys that are nul terminated char arrays (strings). The functions hash_copy_int() and hash_copy_string() are designed to be passed to hash_initialise() as the duplicate_key argument. hash_copy_int() works with keys that are integers and hash_copy_string() works with keys that are nul terminated char arrays (strings). RETURN VALUES The hash_compare_int(), and hash_compare_string() functions return a value less than 0 if key1 is less than key2, a value equal to 0 if key1 is equal to key2 and a value greater than 0 if key1 is greater than key2. hash_hash_int() and hash_hash_string() return a number between 0 and number_of_buckets - 1. hash_copy_int() and hash_copy_string() return 0 on failure and set the global variable errno to indicate the error. EXAMPLES See the tests directory included in the distribution. ERRORS [ENOMEM] A call to malloc failed. SEE ALSO libhash(3) HISTORY The libhash library was written in January 2002 for emmao (a program to kill off rogue processes under Solaris). libhash was written under FreeBSD 4.4. AUTHORS Andrew Stevenson <andrew@ugh.net.au> BUGS hash_hash_string() is a very simple algorithm and good be improved greatly. Please report others to <andrew@ugh.net.au>. UgH! January 14, 2002 UgH!
NAME | LIBRARY | SYNOPSIS | DESCRIPTION | RETURN VALUES | EXAMPLES | ERRORS | SEE ALSO | HISTORY | AUTHORS | BUGS
Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=hash_hash_int&sektion=3&manpath=FreeBSD+13.0-RELEASE+and+Ports>