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

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.5.7
    • Affects Version/s: 1.5.6
    • Component/s: Internal Client
    • None
    • Environment:
      all

      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.

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

              Created:
              Updated:
              Resolved: