stralloc_copy(3)
π NAME π
stralloc_copy β copy data into a stralloc π«Ά
okay so real quick, before we even get into it: this is page stralloc_copy(3) from the Library Functions Manual, part of libowfat. she's a section 3 library function, she's iconic, and she's about to make your stralloc hold a whole new string. let's GO π
π SYNTAX π
#include <libowfat/stralloc.h>
int stralloc_copy(stralloc* sato,stralloc* safrom);
πΈ DESCRIPTION πΈ
So. stralloc_copy copies the string stored in safrom into sa. no cap. it's literally the same thing as calling:
stralloc_copyb(&sato, safrom.s, safrom.len)
so if you already know stralloc_copyb you already know her, she's just the glow-up version that takes a whole stralloc as the source instead of a raw pointer plus a length. β¨
β οΈ heads up bestie: safrom must already be allocated. don't come at her with an unallocated source, she will not be doing that for you. π
the data that sa previously contained? overwritten and truncated. gone. deceased. not coming back. π so if you cared about whatever was in there before, you should've copied it somewhere else first, that's on you.
and if stralloc_copy has trouble allocating memory β like, the allocator said no β she returns 0. otherwise she returns 1. that's it, that's the whole deal.
π₯ RETURN VALUE π₯
1β success, we ate, the copy is copied π0β memory allocation failure, the vibe check failed, no memory for you π
π SEE ALSO π
and that's the page!! π tysm for reading, this was stralloc_copy(3) from the Library Functions Manual (libowfat's own), and yes she's giving library-functions-manual realness. mwah, bye bestie ππ¦
π¦ where this page comes from
- alpine 3.24: libowfat-doc 0.34-r0 Β· GPL-2.0-only
- debian bookworm: libowfat-dev 0.32-4 Β· GPL-2.0-only
- debian trixie: libowfat-dev 0.32-5 Β· GPL-2.0-only
- nixos 26.05: libowfat 0.34
- nixpkgs unstable: libowfat 0.34
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- ubuntu noble: libowfat-dev 0.32-4.1build1 Β· GPL-2.0-only
- ubuntu questing: libowfat-dev 0.32-5
- ubuntu resolute: libowfat-dev 0.34-2 Β· GPL-2.0-only
- ubuntu stonking: libowfat-dev 0.34-2 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms