HASHKIT_IS_ALLOCATED(3)

πŸ’– HASHKIT_IS_ALLOCATED πŸ’–

okay bestie, welcome to hashkit_is_allocated from the libmemcached-awesome manual, section 3 (that's library functions, iykyk). pull up a chair, grab a boba, we're learning ✨


🌸 NAME 🌸

hashkit_is_allocated β€” 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

πŸ¦‹ DESCRIPTION πŸ¦‹

so like, the hashkit_create() function initializes a hashkit object for use. if you pass a nullptr argument for hash, then the memory for the object gets allocated. and if you specify a pre-allocated piece of memory instead? that gets initialized for use. either way, she's ready πŸ’…

the hashkit_clone() function initializes a hashkit object much like hashkit_create() does, BUT instead of using default settings it will use the settings of the ptr hashkit object. it's giving copy-paste but make it intentional 😌

the hashkit_free() frees any resources being consumed by the hashkit objects that were initialized with hashkit_create() or hashkit_clone(). let her go, bestie, she's done her job πŸ•ŠοΈ

the hashkit_is_allocated() reports whether the memory was allocated for a hashkit object. it's literally just a vibe check on your pointer's origin story πŸ”


🌈 RETURN VALUE 🌈

hashkit_create() and hashkit_clone() will return nullptr on failure or pointer to hashkit_st on success. no in-between, no grey area, main character energy only πŸ‘‘

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. slay either way, she's just telling you the truth 🫢


πŸŽ€ SEE ALSO πŸŽ€


heads up bestie: that last one is written exactly as it appears in the original β€” hashkit_function3) β€” so don't come for me, I'm just the messenger 😭

and that's the whole page, periodt πŸ’– this was libmemcached-awesome version 1.1, dated Jul 24, 2025. go forth and free your hashkits responsibly βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from