| 460 | } |
| 461 | |
| 462 | void 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 |
nothing calls this directly
no test coverage detected