MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / PrefixSuccessor

Function PrefixSuccessor

extern/re2/util/strutil.cc:78–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76}
77
78void PrefixSuccessor(std::string* prefix) {
79 // We can increment the last character in the string and be done
80 // unless that character is 255, in which case we have to erase the
81 // last character and increment the previous character, unless that
82 // is 255, etc. If the string is empty or consists entirely of
83 // 255's, we just return the empty string.
84 while (!prefix->empty()) {
85 char& c = prefix->back();
86 if (c == '\xff') { // char literal avoids signed/unsigned.
87 prefix->pop_back();
88 } else {
89 ++c;
90 break;
91 }
92 }
93}
94
95static void StringAppendV(std::string* dst, const char* format, va_list ap) {
96 // First try with a small fixed size buffer

Callers 2

PossibleMatchRangeMethod · 0.85
PossibleMatchRangeMethod · 0.85

Calls 3

pop_backMethod · 0.80
emptyMethod · 0.45
backMethod · 0.45

Tested by

no test coverage detected