1 .\" $OpenBSD: ohash_interval.3,v 1.11 2007/05/31 19:19:30 jmc Exp $
2 .\" Copyright (c) 2001 Marc Espie <espie@openbsd.org>
4 .\" Permission to use, copy, modify, and distribute this software for any
5 .\" purpose with or without fee is hereby granted, provided that the above
6 .\" copyright notice and this permission notice appear in all copies.
8 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 .Dd $Mdocdate: May 31 2007 $
17 .Dt OPEN_HASH_HELPER 3
21 .Nm ohash_create_entry ,
24 .Nd helper functions for open hashing
26 .Fd #include <stdint.h>
27 .Fd #include <stddef.h>
28 .Fd #include <ohash.h>
30 .Fn ohash_interval "const char *start" "const char **pend"
32 .Fn ohash_create_entry "struct ohash_info *info" "const char *start" "const char **pend"
34 .Fn ohash_qlookupi "struct ohash *h" "const char *start" "const char **pend"
36 .Fn ohash_qlookup "struct ohash *h" "const char *start"
38 These functions are commonly used to simplify open hashing usage, and use
40 They operate indifferently on NUL-terminated strings
54 For NUL-terminated strings, as a side effect, those functions
57 to the terminating NUL byte.
60 is a simple hashing function that yields good results on common data sets.
62 .Fn ohash_create_entry
63 can be used to create a new record with a given key.
69 function to allocate the storage.
72 is a wrapper function that simply calls
75 .Fn ohash_lookup_interval .
80 designed for NUL-terminated strings.
84 Those functions are completely non-standard and should be avoided in
87 Those functions were designed and written for
90 by Marc Espie in 1999.