bs_capacityassert(3)
π bs_capacityassert β the manual page, but make it make sense π
okay bestie, sit down, we're learning bs_capacityassert(3) from the Library Functions Manual and honestly? it's giving "small function, big feelings". π
β¨ NAME β¨
bs_capacityassert β assert that there are at least n bytes left in the stream π«Ά
β¨ SYNTAX β¨
#include <libowfat/parse.h>
int bs_capacityassert(struct bytestream* &bs,
size_t capacity);
β¨ DESCRIPTION β¨
so basically π
bs_capacityassert checks whether there are at least this many bytes left in the bytestream. this many = capacity.
- if there aren't enough β it sets the bytestream to the error state and returns
0 - if there are β it returns
1β¨
β οΈ okay this part is important, don't skip it. this compares against the limits of the bytestream, not the actual length. these two things are often the same, but bytestreams can be tied to abuffer*, and in that case the actual length of the stream isn't known beforehand. so even ifbs_capacityassertreturns successful, the following actual reads could still run into an error. no cap. π
bs_capacitycheck does the same thing but it does not set the bytestream to the error state if there isn't enough space. so like, same energy, different consequences. πΈ
use bs_capacityleft to find out how many bytes are left in the bytestream. π
bs_nomoredataassert is the inverse assertion. π
use bs_err to find out whether the bytestream is in the error state. π©Ί
β¨ SEE ALSO β¨
bs_init_membuf(3)bs_init_iobuf(3)bs_init_iobuf_size(3)bs_init_membuf(3)bs_capacitycheck(3)bs_capacityleft(3)bs_err(3)bs_nomoredataassert(3)
and that's the whole page, bestie!! π¦ this was bs_capacityassert(3) from the Library Functions Manual β go forth and assert your capacity, you ate π
β¨
π¦ where this page comes from
- alpine 3.24: libowfat-doc 0.34-r0 Β· 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 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