array_truncate(3)
π array_truncate β the manual page, bestie edition π
okay so this is array_truncate(3) from the Library Functions Manual and it's literally the glow-down your array asked for β¨
β¨ NAME β¨
array_truncate β reduce number of initialized bytes π
πΈ SYNTAX πΈ
#include <libowfat/array.h>
void array_truncate(array* x, uint64 membersize, int64 len);
array_truncate(&x,sizeof(t),len);
π¦ DESCRIPTION π¦
okay so picture this: your array x has been out here living its best life, all these initialized bytes, and you're likeβ¦ bestie, we need to cut. array_truncate reduces the number of initialized bytes in x to exactly len*sizeof(t). iconic. no cap. π
and here's the part where it's lowkey the chillest function ever, because it does literally nothing in like four whole situations:
- if the number of initialized bytes was already this small (or smaller) β no effect π«Ά
- if
lenis negative β no effect π«Ά - if
xis unallocated β no effect π«Ά - if
xhas failed β no effect π«Ά
like, it's giving "I'm not gonna make it worse, I'm just gonna not do anything." main character energy, honestly. π
IMPORTANT: array_truncate does not change the allocation in x. nope. the memory is still there, still vibing, still yours. so if you actually want to free the memory used by x, you need to go use array_reset instead. different function, different vibe, don't mix them up bestie π
π SEE ALSO π
and that's the whole page fr fr π this was array_truncate(3) hanging out under the Library Functions Manual banner, and yes the footer is just the name again because the manpage said so and we respect the manpage π go forth and truncate responsibly, 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