BSON_STRDUP(3)
π BSON_STRDUP(3) π
okay so this is a libbson page bestie, welcome, pull up a chair π
β¨ SYNOPSIS β¨
char *
bson_strdup (const char *str);
like, that's the whole vibe. one function. one string in, one string out. slay.
πΈ PARAMETERS πΈ
strβ a string. that's it. that's the parameter. a string π
π¦ DESCRIPTION π¦
so what does it do? it copies str into a brand new string. a whole new one. not a "here's a pointer to the same thing" situation, an actual fresh copy, no cap π«Ά
and here's the cute little edge case: if str is NULL, then NULL is returned. it doesn't panic, it doesn't explode, it just hands you back NULL and minds its own business. iconic honestly.
π RETURNS π
a newly allocated string π₯ and like β newly allocated is the key phrase here, so please, for the love of everything, free it with bson_free(). don't just let it vibe in memory forever, that's not the move π
π AUTHOR π
MongoDB, Inc β yeah, that MongoDB. the ones you've heard of. iykyk π
β COPYRIGHT β
2009-present, MongoDB, Inc. β the whole run, still going, periodt.
ngl this one's short and sweet, but it's giving "tiny function, big responsibility" β you still gotta bson_free() it. don't forget π
mwah, that's the page π
this was libbson 2.5.6, dated Oct 09, 2026 β go forth and duplicate responsibly, bestie π§β¨
π¦ 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