buffer_fromsa(3)
π buffer_fromsa(3) π
okay bestie, welcome to the Library Functions Manual, section 3, the one and only buffer_fromsa β and yes she's iconic, she's giving "I turn your stralloc into a reading experience" π¦
β¨ NAME β¨
buffer_fromsa β initialize buffer structure from stralloc
no cap, that's literally the whole job description π
πΈ SYNTAX πΈ
#include <libowfat/buffer.h>
void buffer_fromsa(buffer* b,const stralloc* sa);
copy that exactly, don't be out here improvising π
π DESCRIPTION π
so here's the tea: buffer_fromsa makes a virtual read buffer out of a stralloc. The buffer reading functions will be able to read all the way until the end of the data in the stralloc, and then they signal EOF. periodt, that's where it ends π
and here's the cute part β the buffer does not have its own buffer space. nope. she reuses the one that's already in the stralloc. no duplication, no extra memory, just vibes β¨
β οΈ DO NOT TOUCH THEstrallocUNTIL YOU ARE DONE WITH THE BUFFER!! β οΈ like, in particular, do not callstralloc_freeon it! not even a little! that's the number one way to make your program absolutely lose its mind ππ consider this your vibe check, bestie
okay and one more thing, because I know you were gonna ask: reading data from the buffer will not change the stralloc. your data stays exactly as it was. she's a reader, not a writer π
π«Ά SEE ALSO π«Ά
go read those too, they're the whole friend group π
that's the whole page, fr fr. this came to you straight from the Library Functions Manual β buffer_fromsa(3), section 3 β and yeah, she's a keeper π
π stay hydrated, don't free the stralloc, and slay β¨πΈ
π¦ 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