gd_free_entry_strings(3)

πŸ’– gd_free_entry_strings β€” bestie edition πŸ’–

okay so we're in the GETDATA manual, section 3, and this page is all about gd_free_entry_strings 🧹✨


✨ NAME ✨

gd_free_entry_strings β€” literally just frees the strings inside a GetData gd_entry_t object, no drama πŸ’…


🌸 SYNOPSIS 🌸

#include <getdata.h>

gd_entry_t *gd_free_entry_strings(gd_entry_t *entry);

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the tea β˜• β€” gd_free_entry_strings() frees the character strings that live inside the gd_entry_t object called entry, and those strings were previously allocated by a call to gd_entry(3). like, you didn't make those, gd_entry(3) made those, so this is the cleanup crew 🧚

the way that it frees a string and then sets the associated pointer to NULL?? iconic. no dangling pointers in this household πŸ™…β€β™€οΈ

and if entry is NULL? bestie, it just does nothing. not a single thing. vibes only 😌

if entry is non-NULL, it must point to a valid and properly initialised gd_entry_t object, like the kind you'd get back from gd_entry(3). no fake entries, no half-initialised chaos, we're not doing that here 🫢

by default, the strings get deallocated by calling free(3) on each one β€” but lowkey you can bring your own memory manager instead, by calling gd_alloc_funcs(3) before you call this function. customize your whole setup, main character energy fr fr πŸ‘‘

if you wanna know what the gd_entry_t data type even is, go read gd_entry(3), it's all in there πŸ“–


⭐ RETURN VALUE ⭐

gd_free_entry_strings() always returns its input, entry. that's it. that's the whole return value. it hands you back what you gave it πŸ’


πŸŽ€ NOTES πŸŽ€

this function is provided as a convenience only β€” a little treat, a lil helper, a shortcut πŸ“

like, the caller is fully allowed to deallocate the strings in the gd_entry_t object provided by gd_entry(3) themselves, simply by calling the deallocator on each initialised string member, if they'd rather do it that way. you do you, bestie πŸ’œ


🌈 HISTORY 🌈

  • the dirfile_free_entry_strings() function appeared in GetData-0.3.0 β€” a classic, an OG πŸ•°οΈ
  • in GetData-0.7.0, this function was renamed to gd_free_entry_strings(). glow-up era ✨

πŸ‘‘ SEE ALSO πŸ‘‘


and that's the whole page, no cap πŸ’– this was Version 0.10.0, dated 25 December 2016 β€” happy holidays from the GetData girlies, mwah πŸŽ€πŸ¦‹πŸŒΈ