Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-1496

StringData should have an explicit constructor taking both a const char* and a length

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Minor - P4 Minor - P4
    • 1.5.7
    • 1.5.6
    • Internal Client
    • None
    • all

    Description

      If you already know the length of a const char*, but that const char* doesn't happen to be a string literal, there is currently no way to construct a StringData object that captures both the string pointer and the known length without an additional call to strlen. Adding an new constructor that takes a const char* and a length would fix this.

      I have a patch for this in progress and I will post a github pull request with the fix later today, so feel free to assign it to me, or to Alberto if that is not possible.

      Attachments

        Activity

          People

            eliot Eliot Horowitz (Inactive)
            andrew.morrow@mongodb.com Andrew Morrow (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: