HASHKIT_FREE(3)
π HASHKIT_FREE(3) π
okay bestie, this page lives in the libmemcached-awesome manual, and it's literally the whole libhashkit documentation you need to know about making and destroying hashkit objects. it's giving "housekeeping but make it cute" β¨
πΈ NAME πΈ
hashkit_free β libhashkit Documentation
π 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 -- memory address of a hashkit_st struct; if a
nullptr is passed, the struct will be dynamically
allocated by libhashkit
Returns
pointer to initialized hashkit_st structure
hashkit_st *hashkit_clone(hashkit_st *destination, const hashkit_st
*ptr)
Parameters
β’ destination -- memory address of a hashkit_st struct; if
a nullptr is passed, the struct will be dynamically
allocated by libhashkit
β’ ptr -- pointer of the hashkit_st struct to copy
Returns
pointer to a hashkit_st structure (destination, if not
nullptr), initialized from ptr
void hashkit_free(hashkit_st *hash)
Parameters
hash -- pointer to an initialized hashkit_st struct
bool hashkit_is_allocated(const hashkit_st *hash)
Parameters
hash -- pointer to an initialized hashkit_st struct
Returns
bool, whether the hash struct was dynamically allocated
so yes, you compile and link with -lhashkit, and the whole cast is:
hashkit_create(hashkit_st *hash)β the constructor bestie π«Άhashβ memory address of ahashkit_ststruct; if anullptris passed, the struct will be dynamically allocated by libhashkit- returns: pointer to initialized
hashkit_ststructure
hashkit_clone(hashkit_st *destination, const hashkit_st *ptr)β the copycat π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 notnullptr), initialized fromptr
void hashkit_free(hashkit_st *hash)β the cleanup, we love a tidy queen π§Ήhashβ pointer to an initializedhashkit_ststruct
bool hashkit_is_allocated(const hashkit_st *hash)β the vibe check on who owns the memory πhashβ pointer to an initializedhashkit_ststruct- returns:
bool, whether the hash struct was dynamically allocated
β¨ DESCRIPTION β¨
so hashkit_create() initializes a hashkit object for use. if you pass a nullptr argument for hash, then the memory for the object is allocated. if you specify a pre-allocated piece of memory, that is initialized for use. either way, she's ready π
the hashkit_clone() function initializes a hashkit object much like hashkit_create(), but instead of using default settings it will use the settings of the ptr hashkit object. not me copy-pasting my whole personality onto a new struct π
the hashkit_free() frees any resources being consumed by the hashkit objects that were initialized with hashkit_create() or hashkit_clone(). this is the part where you actually let go. main character energy is knowing when to release π₯
the hashkit_is_allocated() reports whether the memory was allocated for a hashkit object. fr fr, sometimes you gotta ask "is this mine or did the library make it".
β RETURN VALUE β
hashkit_create() and hashkit_clone() will return nullptr on failure or pointer to hashkit_st on success. no in-between, no maybes.
hashkit_is_allocated() returns true if the memory for the hashkit object was allocated inside of hashkit_create() or hashkit_clone(), otherwise it is false and was user-supplied memory. that's it, that's the whole test π
π¦ SEE ALSO π¦
libhashkit(3)hashkit_value(3)hashkit_function3)
iykyk, go read those next bestie π
π quick reminder thathashkit_is_allocated()returningfalsemeans that memory was user-supplied, so don't go freeing things you didn't allocate. the audacity would be unmatched.
and that's the page, periodt. this was libmemcached-awesome, version 1.1, dated Jul 24, 2025 β mwah, iconic, no cap πβ¨π«Ά
π¦ 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