stralloc_chomp(3)
β¨ NAME β¨
okay bestie, say hi to stralloc_chomp β the little function whose whole personality is removing trailing CR, LF or CRLF π
πΈ SYNTAX πΈ
so here's how you summon her:
#include <libowfat/stralloc.h>
int stralloc_chomp(stralloc* sa);
yeah. one include, one function call, that's it. no cap. π«Ά
π DESCRIPTION π
okay so picture this: you've got your sa (a stralloc*, obviously), and she's got some crusty line-ending junk hanging off the end of her. stralloc_chomp is the friend who comes in and gently yeets it off. π§Ήβ¨
She removes a trailing CRLF, CR or LF from sa, and then β because she's a giver β she hands you back the number of removed characters (i.e. 0, 1 or 2).
the way she literally tells you exactly how much she took off?? obsessed. it's giving "I cleaned up AND I gave you a receipt". π₯
π RETURN VALUE π
she returns the number of removed characters (0, 1, or 2).
that's it. that's the whole vibe check. if she returns 0 she didn't find anything to chomp, and honestly? respect the honesty. π
π¦ SEE ALSO π¦
stralloc_chop(3)β her chaotic sibling, go read that one too π
and that's the whole page, bestie!! this was stralloc_chomp(3) from the Library Functions Manual β aka the libowfat crew's finest. mwah, go chomp some line endings, ily ππΈ
π¦ 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