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


Manual Reference Pages  -  HASH_COPY_INT (3)

NAME

hash_compare_int, hash_compare_string, hash_hash_int, hash_hash_string, hash_copy_int, hash_copy_string - libhash convenience functions

CONTENTS

Library
Synopsis
Description
Return Values
Examples
Errors
See Also
History
Authors
Bugs

LIBRARY

Hash Library (libhash, -lhash)

SYNOPSIS


.In sys/types.h
.In 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 parameters.

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
.Vt char arrays (strings). hash_compare_string performs a case sensistive lexicographical 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
.Vt 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
.Vt 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
.Fx 4.4 .

AUTHORS


.An Andrew Stevenson Aq 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>.

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 manServer 1.07.