Skip to content

Commit

Permalink
SERVER-20974 fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
acmorrow committed Oct 19, 2015
1 parent b0c0ab7 commit 10f76c1
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/mongo/base/string_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ class StringData {
StringData(const char* c, size_t len, TrustedInitTag) : _data(c), _size(len) {}

public:
/** Constructs an empty StringData */
/** Constructs an empty StringData. */
StringData() = default;

/**
* Constructs a StringData, for the case where the length of the
* string is not known. 'c' must be a pointer to a null-terminated
* string.
* string is not known. 'c' must either be NULL, or a pointer to a
* null-terminated string.
*/
StringData(const char* str) : StringData(str, str ? std::strlen(str) : 0) {}

Expand All @@ -80,21 +80,22 @@ class StringData {
StringData(const char(&val)[N], LiteralTag)
: StringData(&val[0], N - 1) {}

/** Constructs a StringData, for the case of a std::string. We can
/**
* Constructs a StringData, for the case of a std::string. We can
* use the trusted init path with no follow on checks because
* string::data is assured to never return nullptr.
*/
StringData(const std::string& s) : StringData(s.data(), s.length(), TrustedInitTag()) {}

/**
* Constructs a StringData with an explicit length. 'c' must be a
* Constructs a StringData with an explicit length. 'c' must
* either be NULL (in which case len must be zero), or be a
* pointer into a character array. The StringData will refer to
* the first 'len' characters starting at 'c'. The range of
* characters c to c+len must be valid.
*/
StringData(const char* c, size_t len) : StringData(c, len, TrustedInitTag()) {
if (kDebugBuild)
invariant(_data || (_size == 0));
invariant(_data || (_size == 0));
}

/**
Expand Down

0 comments on commit 10f76c1

Please sign in to comment.