e74550f59c1d1629d52f3992ada85e071537949a
[awesomized/libmemcached] / docs / source / libhashkit / hashkit_create.rst
1 Creating a hashkit structure
2 ============================
3
4 SYNOPSIS
5 --------
6
7 #include <libhashkit-|libhashkit_version|/hashkit.h>
8 Compile and link with -lhashkit
9
10 .. type:: struct hashkit_st hashkit_st
11
12 .. function:: hashkit_st *hashkit_create(hashkit_st *hash)
13
14 .. function:: hashkit_st *hashkit_clone(hashkit_st *destination, const hashkit_st *ptr)
15
16 .. function:: void hashkit_free(hashkit_st *hash)
17
18 .. function:: bool hashkit_is_allocated(const hashkit_st *hash)
19
20 DESCRIPTION
21 -----------
22
23 The `hashkit_create` function initializes a hashkit object for use. If you pass
24 a NULL argument for hash, then the memory for the object is allocated. If you
25 specify a pre-allocated piece of memory, that is initialized for use.
26
27 The `hashkit_clone` function initializes a hashkit object much like
28 `hashkit_create`, but instead of using default settings it will use the settings
29 of the ptr hashkit object.
30
31 The `hashkit_free` frees any resources being consumed by the hashkit objects
32 that were initialized with `hashkit_create` or `hashkit_clone`.
33
34 The `hashkit_is_allocated` reports where the memory was allocated for a hashkit
35 object.
36
37 RETURN VALUE
38 ------------
39
40 `hashkit_create` and `hashkit_clone` will return NULL on failure or non-NULL on
41 success.
42
43 `hashkit_is_allocated` returns true if the memory for the hashkit object was
44 allocated inside of `hashkit_create` or `hashkit_clone`, otherwise it is false
45 and was user-supplied memory.
46
47 SEE ALSO
48 --------
49
50 .. only:: man
51
52 :manpage:`libhashkit(3)`
53 :manpage:`hashkit_value(3)`
54 :manpage:`hashkit_function3)`
55
56 .. only:: html
57
58 * :doc:`../libhashkit`
59 * :doc:`hashkit_value`
60 * :doc:`hashkit_function`