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