MCPcopy Create free account
hub / github.com/apache/brpc / FormatStringImpl

Method FormatStringImpl

src/brpc/redis_reply.cpp:462–479  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

460}
461
462void RedisReply::FormatStringImpl(const char* fmt, va_list args, RedisReplyType type) {
463 va_list copied_args;
464 va_copy(copied_args, args);
465 char buf[64];
466 int ret = vsnprintf(buf, sizeof(buf), fmt, copied_args);
467 va_end(copied_args);
468 if (ret < 0) {
469 LOG(FATAL) << "Fail to vsnprintf into buf=" << (void*)buf << " size=" << sizeof(buf);
470 return;
471 } else if (ret < (int)sizeof(buf)) {
472 return SetStringImpl(buf, type);
473 } else {
474 std::string str;
475 str.reserve(ret + 1);
476 butil::string_vappendf(&str, fmt, args);
477 return SetStringImpl(str, type);
478 }
479}
480
481} // namespace brpc

Callers

nothing calls this directly

Calls 3

vsnprintfFunction · 0.85
string_vappendfFunction · 0.85
reserveMethod · 0.45

Tested by

no test coverage detected