MCPcopy Create free account
hub / github.com/apache/impala / StrCatNineOrMore

Function StrCatNineOrMore

be/src/gutil/strings/strcat.cc:150–170  ·  view source on GitHub ↗

StrCat with this many params is exceedingly rare, but it has been requested... therefore we'll rely on default arguments to make calling slightly less efficient, to preserve code size.

Source from the content-addressed store, hash-verified

148// requested... therefore we'll rely on default arguments to make calling
149// slightly less efficient, to preserve code size.
150string StrCatNineOrMore(const AlphaNum *a, ...) {
151 string result;
152
153 va_list args;
154 va_start(args, a);
155 size_t size = a->size();
156 while (const AlphaNum *arg = va_arg(args, const AlphaNum *)) {
157 size += arg->size();
158 }
159 STLStringResizeUninitialized(&result, size);
160 va_end(args);
161 va_start(args, a);
162 char *const begin = &*result.begin();
163 char *out = Append1(begin, *a);
164 while (const AlphaNum *arg = va_arg(args, const AlphaNum *)) {
165 out = Append1(out, *arg);
166 }
167 va_end(args);
168 DCHECK_EQ(out, begin + size);
169 return result;
170}
171
172} // namespace internal
173} // namespace strings

Callers 1

StrCatFunction · 0.85

Calls 4

Append1Function · 0.85
sizeMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected