NNG_STRFREE(3)

πŸ“¦
version 1.12.0 Β· 4 versions
, in ubuntu stonking

✨ NAME ✨

nng_strfree β€” free memory, bestie πŸ’– (like the manual says: "free memory")

Okay so this is from the NNG Reference Manual, page NNG_STRFREE(3), and it's literally just one tiny little function that does one tiny little job. Slay.


🌸 SYNOPSIS 🌸

#include <nng/nng.h>

void nng_strfree(char *str);

That's it. That's the whole vibe. 🫢


πŸ’… DESCRIPTION πŸ’…

So the nng_strfree() function deallocates the string str. Freeing it. Releasing it. Sending it back to the void. πŸ¦‹

Here's the tea though β€” it's equivalent to calling nng_free() with the length of str plus one as the size (that extra one is for the NUL terminating byte, you have to count the terminator, no cap).

⚠️ Important: This should only be used with strings that were allocated by nng_strdup() or nng_alloc(). In all cases, the allocation size of the string must be the same as strlen(str) + 1. Periodt.
⚠️ Important (yes, a second one, it's serious): Consequently, if the string created with nng_strdup() is modified to be shorter, then it is incorrect to call this function. 😭 (The nng_free() function can be used instead in that case, using the length of the original string plus one for the size.)

The way that shrinking a string quietly breaks this... πŸ™ˆ read the warnings, i'm begging.


⭐ RETURN VALUES ⭐

None. Nothing. Zero. She gives you nothing back and honestly? Iconic. πŸ’€


🌈 ERRORS 🌈

None. Can't error if you don't have anything to report, iykyk. ✨


πŸŽ€ SEE ALSO πŸŽ€


Okay that's the whole page bestie, you're so welcome πŸ’– This was the NNG Reference Manual, page NNG_STRFREE(3), dated 2026-06-30 β€” go free your strings responsibly, mwah πŸ‘‘πŸŒΈπŸ§š

πŸ“¦ where this page comes from