Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-2360

decimal128 and regex functions that accept string lengths

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.10.0
    • Affects Version/s: None
    • Component/s: libbson
    • Labels:
    • Fully Compatible

      There are still a few functions that only take raw char* pointers to null terminated buffers. This makes it hard for the C++ driver, since it often deals in string_views that aren't ensured to be null terminated. In those instances, we must construct a temporary std::string (with the associated heap allocation) from our string_view, and then pass those into the C driver, which then calls strlen on it.

      A few functions known to have this issue, notably the bson_append family functions for dbpointer, code, codewscope, and regex. It also appears that the decimal128_[to,from]_string functions have this issue.

      While it may not make sense to address this for the deprecated types, fixing it for at least regex and decimals seems worthwhile.

            xiangyu.yao@mongodb.com Xiangyu Yao (Inactive)
            andrew.morrow@mongodb.com Andrew Morrow (Inactive)
            0 Vote for this issue
            3 Start watching this issue