BSON_STRING_NEW(3)
π BSON_STRING_NEW π
okay bestie, so this one is a libbson page, and it's the β¨ string builder β¨ origin story. fair warning though, she's a legacy queen now β deprecated since version 1.29.0 β so appreciate her for the lore but don't build your whole personality on her, mwah π
πΈ SYNOPSIS πΈ
bson_string_t *
bson_string_new (const char *str);
like... that's it. that's the whole vibe. one function, one arg, one little pointer of destiny π«Ά
π PARAMETERS π
strβ a string you want copied, orNULL. literally your choice, she supports both, no judgement π
β¨ DESCRIPTION β¨
So what she does is create a brand-new string builder, and the way she grows is power-of-two growth of buffers β like, she doubles up when she needs more room, which is honestly so main character of her π¦
Once you've got her, you use the various bson_string_append*() functions to append stuff onto the string. that's the whole workflow, no cap.
BIG WARNING, LOCK IN: the length of the resulting string β and yes, that includes theNULLterminator, bestie, don't forget her β MUST NOT exceedUINT32_MAX. that's not a suggestion, that's a hard limit. exceed it and things get real bad real fast π
π«Ά RETURNS π«Ά
She hands you back a newly allocated bson_string_t β and here's the part people always forget β you gotta free her with bson_string_free() when you're done with her. no ghosting your allocations, that's not the energy we're bringing into this repo π
π AUTHOR π
MongoDB, Inc β the icons themselves, periodt.
π COPYRIGHT π
2009-present, MongoDB, Inc.
and that's the page!! π this was libbson version 1.30.13, dated Oct 09, 2026 β go free your strings and hydrate, ily bye πβ¨
π¦ where this page comes from
- fedora 43: libbson-devel 1.30.13-1.fc43 Β· Apache-2.0 AND ISC AND MIT AND Zlib
- fedora 43: libbson-devel 1.30.13-1.fc43 Β· Apache-2.0 AND ISC AND MIT AND Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms