GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
OHASH_INTERVAL(3) FreeBSD Library Functions Manual OHASH_INTERVAL(3)

ohash_interval, ohash_create_entry, ohash_qlookup, ohash_qlookupi
helper functions for open hashing

OpenBSD Utilities Library (libopenbsd, -lopenbsd)

#include <stdint.h>
#include <stddef.h>
#include <ohash.h>

uint32_t
ohash_interval(const char *start, const char **pend);

void *
ohash_create_entry(struct ohash_info *info, const char *start, const char **pend);

unsigned int
ohash_qlookupi(struct ohash *h, const char *start, const char **pend);

unsigned int
ohash_qlookup(struct ohash *h, const char *start);

These functions are commonly used to simplify open hashing usage, and use similar conventions. They operate indifferently on NUL-terminated strings (by setting *pend = NULL) or memory ranges (delimited by start and *pend). For NUL-terminated strings, as a side effect, those functions set *pend to the terminating NUL byte.

ohash_interval() is a simple hashing function that yields good results on common data sets.

ohash_create_entry() can be used to create a new record with a given key. In that case, the alloc field of info should point to a malloc(3)-like function to allocate the storage:

p = (*info->alloc)(sz, info->data);

ohash_qlookupi() is a wrapper function that simply calls ohash_interval() and ohash_lookup_interval().

ohash_qlookup() is a variation on ohash_qlookupi() designed for NUL-terminated strings.

ohash_init(3)

Those functions are completely non-standard and should be avoided in portable programs.

Those functions were designed and written for OpenBSD make(1) by Marc Espie in 1999.
June 5, 2013 FreeBSD 13.1-RELEASE

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.