1 Creating a hashkit structure
2 ============================
7 #include <libhashkit-|libhashkit_version|/hashkit.h>
8 Compile and link with -lhashkit
10 .. type:: struct hashkit_st hashkit_st
12 .. function:: hashkit_st *hashkit_create(hashkit_st *hash)
14 :param hash: memory address of a `hashkit_st` struct;
15 if a nullptr is passed, the struct will be dynamically allocated by libhashkit
16 :returns: pointer to initialized `hashkit_st` structure
18 .. function:: hashkit_st *hashkit_clone(hashkit_st *destination, const hashkit_st *ptr)
20 :param destination: memory address of a `hashkit_st` struct;
21 if a nullptr is passed, the struct will be dynamically allocated by libhashkit
22 :param ptr: pointer of the `hashkit_st` struct to copy
23 :returns: pointer to a `hashkit_st` structure (`destination`, if not nullptr), initialized from `ptr`
25 .. function:: void hashkit_free(hashkit_st *hash)
27 :param hash: pointer to an initialized `hashkit_st` struct
29 .. function:: bool hashkit_is_allocated(const hashkit_st *hash)
31 :param hash: pointer to an initialized `hashkit_st` struct
32 :returns: bool, whether the `hash` struct was dynamically allocated
37 The `hashkit_create` function initializes a hashkit object for use. If you pass
38 a nullptr argument for hash, then the memory for the object is allocated. If you
39 specify a pre-allocated piece of memory, that is initialized for use.
41 The `hashkit_clone` function initializes a hashkit object much like
42 `hashkit_create`, but instead of using default settings it will use the settings
43 of the ptr hashkit object.
45 The `hashkit_free` frees any resources being consumed by the hashkit objects
46 that were initialized with `hashkit_create` or `hashkit_clone`.
48 The `hashkit_is_allocated` reports whether the memory was allocated for a hashkit
54 `hashkit_create` and `hashkit_clone` will return nullptr on failure or pointer
55 to `hashkit_st` on success.
57 `hashkit_is_allocated` returns true if the memory for the hashkit object was
58 allocated inside of `hashkit_create` or `hashkit_clone`, otherwise it is false
59 and was user-supplied memory.
66 :manpage:`libhashkit(3)`
67 :manpage:`hashkit_value(3)`
68 :manpage:`hashkit_function3)`
72 * :doc:`../libhashkit`
73 * :doc:`hashkit_value`
74 * :doc:`hashkit_function`