BSON_STRNLEN(3)
π BSON_STRNLEN(3) π
okay so this is bson_strnlen, and it lives in libbson (that's the manual name bestie, we're in libbson land π¦). it's a tiny little function but it's lowkey doing the most for portability, and honestly? we stan a supportive icon.
β¨ SYNOPSIS β¨
size_t
bson_strnlen (const char *s, size_t maxlen);
literally the whole signature, no notes π
π PARAMETERS π
sβ a string. that's it, that's the whole vibe. just a string π«Άmaxlenβ the maximum size of string to check. like a little fence so we don't run off the edge πΈ
π DESCRIPTION π
so bson_strnlen() is a portable version of strnlen(). that's the entire description and honestly it ate π
if your platform is being weird about strnlen(), this is your girl. main character energy, works everywhere, no cap.
β RETURNS β
it gives you back the length of s in bytes β OR maxlen if no \0 was found. so basically: it counts until it hits the null terminator, but if there's no \0 in sight it just throws its hands up and reports maxlen π no drama, no overrun, just boundaries. we love a queen who respects limits πβ¨
π AUTHOR π
MongoDB, Inc β the icons behind it all π
π COPYRIGHT π
2009-present, MongoDB, Inc. β yeah, they've been at this a minute, fr fr π§
and that's the whole page bestie!! written by the libbson girlies in version 2.5.6, dated Oct 09, 2026 β go forth and measure your strings safely, mwah πππ₯
π¦ where this page comes from
- epel 10: libbson-devel 2.5.6-1.el10_3 Β· Apache-2.0 AND ISC AND MIT AND Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms