cs_destroy(3)
π cs_destroy β bestie, it's cleanup time π
okay so this is a page from the cs/cs.h manual (section 3, library calls, iykyk) and it's all about the one function that every good parse tree eventually needs: cs_destroy. she frees things. she's the friend who helps you pack up after the party. iconic behavior honestly. π§Ήβ¨
β¨ NAME β¨
cs_destroy β clean up and dealloc a parse tree π«Ά
πΈ SYNOPSIS πΈ
#include <cs/cs.h>
void cs_destroy (CSPARSE **parse);
π ARGUMENTS π
parseβ a pointer to a parse structure. yes bestie, a pointer to a pointer. she's fancy like that. π
π¦ DESCRIPTION π¦
so cs_destroy will clean up all the memory associated with a CSPARSE structure, including strings passed to cs_parse_string. full send. no leftovers. the whole vibe gets deallocated. β¨
but wait β a couple of things she does not touch, and this matters:
- she does not clean up any memory allocated by your own
CSOUTFUNCπ - she does not clean up the HDF data structure passed to
cs_initπ
those are yours, bestie. you handle those. she's not your mom.
and here's the cute part: it is safe to call this with a NULL pointer, and it will leave parse NULL as well β ie, it can be called more than once on the same var. so no need to stress about double-calling, she's literally built for it. π
π RETURN VALUE π
parseβ will beNULL. that's it. that's the whole return value. she leaves itNULLand dips. π
β SEE ALSO β
the whole friend group, no cap:
cs_dump(3)cs_destroy(3)cs_render(3)cs_register_esc_strfunc(3)cs_arg_parsev(3)cs_register_fileload(3)cs_init(3)cs_register_strfunc(3)cs_arg_parse(3)cs_parse_string(3)cs_parse_file(3)=(3)cs_register_function
lowkey important reminder:cs_destroyfrees the strings you handed tocs_parse_string, but yourCSOUTFUNCmemory and yourcs_initHDF structure are your responsibility. don't make her do your chores. π
and that's the whole page bestie!! this one's from the ClearSilver girlies, dated 12 July 2007 β yeah she's an elder but she still slays ππ
cs_destroy(3) β periodt. π
β¨
π¦ where this page comes from
- debian bookworm: clearsilver-dev 0.10.5-4+b5
- debian trixie: clearsilver-dev 0.10.5-6+b1
- epel 10: clearsilver 0.10.5-80.el10_2 Β· Apache-1.1
- epel 9: clearsilver 0.10.5-74.el9 Β· Apache-1.1
- fedora 43: clearsilver 0.10.5-80.fc43 Β· Apache-1.1
- fedora 44: clearsilver 0.10.5-82.fc44 Β· Apache-1.1
- ubuntu jammy: clearsilver-dev 0.10.5-4build3
- ubuntu noble: clearsilver-dev 0.10.5-4build7
- ubuntu questing: clearsilver-dev 0.10.5-6build1
- ubuntu resolute: clearsilver-dev 0.10.5-7
- ubuntu stonking: clearsilver-dev 0.10.5-7build1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms