jwt_memory_grp(3)

πŸ“¦
version 3.3.3 Β· 2 versions
, in ubuntu stonking

πŸ’– jwt_memory_grp β€” Memory Handlers πŸ’–

okay so bestie, this is a page from the LibJWT library manual, section 3 (that's the library-functions girlies, not the shell-command ones). It's literally just the memory-handler corner of LibJWT: the two typedefs and the two functions that let you tell LibJWT how to grab and release memory. Small page, big main-character energy. Let's go. ✨


🌸 SYNOPSIS 🌸

πŸŽ€ Typedefs

  • typedef void *(* jwt_malloc_t) (size_t) β€” the prototype vibe for malloc(3). πŸ‘‘
  • typedef void(* jwt_free_t) (void *) β€” the prototype vibe for free(3). πŸ¦‹

πŸŽ€ Functions

  • int jwt_set_alloc (jwt_malloc_t pmalloc, jwt_free_t pfree) β€” set the functions that get used for memory management. πŸ’…
  • void jwt_get_alloc (jwt_malloc_t *pmalloc, jwt_free_t *pfree)

✨ Detailed Description ✨

These functions allow you to get or set memory allocation functions. That's it, that's the whole thesis. Get them, set them, live your truth. 🫢


🧚 Typedef Documentation 🧚

🌈 typedef void(* jwt_free_t) (void *)

Prototype for free(3). no cap.

🌈 typedef void *(* jwt_malloc_t) (size_t)

Prototype for malloc(3). fr fr.


πŸ’œ Function Documentation πŸ’œ

⭐ void jwt_get_alloc (jwt_malloc_t * pmalloc, jwt_free_t * pfree)

Get functions used for allocating and freeing memory. Like, hand me the receipts on whatever allocator is currently in the building. πŸ”

Parameters

  • pmalloc β€” Pointer to malloc function output variable, or NULL
  • pfree β€” Pointer to free function output variable, or NULL

⭐ int jwt_set_alloc (jwt_malloc_t pmalloc, jwt_free_t pfree)

Set functions to be used for memory management. By default, LibJWT uses malloc and free for memory management. This function allows the user of the library to specify its own memory management functions. This is especially useful on Windows where mismatches in runtimes across DLLs can cause problems. 😭 (windows DLL runtime mismatch is genuinely the villain of this story, iykyk)

The caller can specify either a valid function pointer for any of the parameters or NULL to use the corresponding default allocator function. so like, mix and match, do your thing. πŸŽ€

Note β€” This function will also set the memory allocator for the Jansson library. not just LibJWT, bestie. it's giving shared custody. πŸ‘€

Parameters

  • pmalloc β€” The function to use for allocating memory or NULL to use malloc
  • pfree β€” The function to use for freeing memory or NULL to use free

Returns

0 on success or errno otherwise. 🌟


πŸ‘‘ Author πŸ‘‘

Generated automatically by Doxygen for LibJWT from the source code. (yes, a robot wrote the original, and honestly? slay.) πŸ€–πŸ’–


k bye bestie, that's the whole page!! this was LibJWT, Version 3.3.3, manual section jwt_memory_grp(3) β€” go set your allocators and be free. πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from