libwget-mem(3)
π libwget-mem β Memory functions π
okay bestie, so this is libwget-mem, from the libwget crew, and it's literally just a lil grab-bag of memory helpers. It's giving "the standard library forgot these so we wrote them ourselves." π
β¨ SYNOPSIS β¨
πΈ Functions πΈ
void * wget_memdup (const void *m, size_t n)
char * wget_strdup (const char *s)
char * wget_strmemdup (const void *m, size_t n)
size_t wget_strmemcpy (char *s, size_t ssize, const void *m, size_t n)
void * wget_strmemcpy_a (char *s, size_t ssize, const void *m, size_t n)
π¦ Detailed Description π¦
This is a collection of short memory functions that are not available in the standard libraries. No cap, that's the whole vibe. π
π Function Documentation π
π void * wget_memdup (const void * m, size_t n)
Parameters
mβ Memory to clonenβ Length of memory
Returns
- Cloned memory
Clone's the memory region m with length n. Returns NULL if m is NULL.
bestie pls β you should free() the returned pointer when you don't need it any more. don't be that girl who leaks. π
π char * wget_strdup (const char * s)
Parameters
sβ String to clone
Returns
- Cloned string
Clone's the string s like strdup() does. Returns NULL if s is NULL.
same energy: free() the returned string when it's served its purpose. π«Ά
π char * wget_strmemdup (const void * m, size_t n)
Parameters
mβ Memory to convert into stringnβ Length of memory
Returns
- Created string
Convert the given memory region m with length n into a C string. Returns NULL if m is NULL.
and yes, once again: free() the returned string when you're done with it. the way that this family stays consistent π
π size_t wget_strmemcpy (char * s, size_t ssize, const void * m, size_t n)
Parameters
sβ Buffer to hold the C string outputssizeβ Size of the output buffermβ Memory to read fromnβ Length of memory
Returns
- Number of bytes copied, not counting the trailing
0byte
Convert the given memory region m with length n into a C string at s. A max. of ssize - 1 is copied into s. lowkey important detail, don't sleep on it β
π void * wget_strmemcpy_a (char * s, size_t ssize, const void * m, size_t n)
Parameters
sβ Buffer to hold the C string outputssizeβ Size of the output buffermβ Memory to read fromnβ Length of memory
Returns
- Pointer to destination (either
sor a freshly allocated buffer)
Convert the given memory region m with length n into a C string at s or at freshly allocated memory, if the space in s was not sufficient.
If s was too small to hold n + 1 bytes, the result must be free'd after use, like this:
if (res != s) wget_free(res);
π¨ bestie the vibe check here is REAL: if you skip that check you're leaking memory, and the leak is not cute. main character energy means cleaning up after yourself. periodt. π₯
π§ Author π§
Generated automatically by Doxygen for wget2 from the source code. (not me writing my own wiki page, the robots did it π)
okay that's the whole page, ily, go forth and clone memory responsibly ππ
β¨ cute lil sign-off: this waslibwget-mem(3)from wget2, Version 2.3.0 β bye bestie, drink water,free()your pointers ππ¦π
π¦ where this page comes from
- fedora 43: wget2-devel 2.3.0-2.fc43 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND GFDL-1.3-or-later
- fedora 43: wget2-devel 2.3.0-2.fc43 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND GFDL-1.3-or-later
- fedora 44: wget2-devel 2.3.0-1.fc44
- fedora 44: wget2-devel 2.3.0-1.fc44
- fedora 44: wget2-devel 2.3.0-3.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND GFDL-1.3-or-later
- fedora 44: wget2-devel 2.3.0-3.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND GFDL-1.3-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms