HASHKIT_CREATE(3)
π¦ NAME π¦
hashkit_create β it's the libhashkit documentation bestie, we're doing the whole hashkit object lifecycle here π
Oh also hiii, you're reading the HASHKIT_CREATE(3) page from the libmemcached-awesome manual. Yes queen, section 3, library functions, let's GO.
πΈ SYNOPSIS πΈ
#include <libhashkit-1.0/hashkit.h>
Compile and link with -lhashkit
typedef struct hashkit_st hashkit_st
β¨ hashkit_st *hashkit_create(hashkit_st *hash)
Parameters
hashβ the memory address of ahashkit_ststruct. If you pass anullptr, the struct gets dynamically allocated by libhashkit for you π«Ά
Returns
- pointer to the initialized
hashkit_ststructure
β¨ hashkit_st *hashkit_clone(hashkit_st *destination, const hashkit_st *ptr)
Parameters
destinationβ memory address of ahashkit_ststruct; if anullptris passed, the struct will be dynamically allocated by libhashkitptrβ pointer of thehashkit_ststruct to copy
Returns
- pointer to a
hashkit_ststructure (destination, if it wasn'tnullptr), initialized fromptr
β¨ void hashkit_free(hashkit_st *hash)
Parameters
hashβ pointer to an initializedhashkit_ststruct
β¨ bool hashkit_is_allocated(const hashkit_st *hash)
Parameters
hashβ pointer to an initializedhashkit_ststruct
Returns
bool, whether the hash struct was dynamically allocated
π DESCRIPTION π
Okay so hashkit_create() initializes a hashkit object so it's ready to be used, iconic behavior honestly. Pass a nullptr as the hash argument and the memory for the object gets allocated for you (so generous π). Or, if you hand it a pre-allocated piece of memory, that gets initialized for use instead. Either way you're covered.
Then there's hashkit_clone(), which initializes a hashkit object pretty much the same way as hashkit_create(), except β plot twist β it doesn't use the default settings. It uses the settings of the ptr hashkit object instead. Copying the vibe, not the defaults. β¨
hashkit_free() frees any resources being consumed by hashkit objects that were initialized with hashkit_create() or hashkit_clone(). Clean up after yourself, bestie, no cap π§Ή
And hashkit_is_allocated() reports whether the memory was allocated for a hashkit object. Yes, that's the whole thing. It just tells you. π
π RETURN VALUE π
hashkit_create() and hashkit_clone() will return nullptr on failure, or a pointer to hashkit_st on success. Slay when it works, nullptr when it doesn't π
hashkit_is_allocated() returns true if the memory for the hashkit object was allocated inside of hashkit_create() or hashkit_clone(). Otherwise it's false, and that means the memory was user-supplied. Periodt.
π SEE ALSO π
libhashkit(3) hashkit_value(3) hashkit_function3)
ngl bestie, that last one is written exactly like that in the original. Not me fixing it. Not my job. It's giving "as-shipped" π
That's the whole page! Brought to you by libmemcached-awesome, version 1.1, dated Jul 24, 2025 β mwah, take care of your hashkit objects and they'll take care of you π«Άπβ¨
π¦ where this page comes from
- fedora 43: libmemcached-awesome-devel 1.1.4-7.fc43 Β· BSD-3-Clause
- fedora 43: libmemcached-awesome-devel 1.1.4-7.fc43 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms