MCPcopy Create free account
hub / github.com/Tencent/phxrpc / StrAppendFormat

Function StrAppendFormat

codegen/code_utils.cpp:58–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56}
57
58void StrAppendFormat(string *result, const char *fmt, ...) {
59 if (nullptr == fmt)
60 return;
61
62 size_t len = 0;
63 {
64 va_list va;
65 va_start(va, fmt);
66 len = vsnprintf(NULL, 0, fmt, va);
67 va_end(va);
68 }
69
70 if (len > 0) {
71 size_t old_len = result->size();
72 result->resize(old_len + len);
73
74 va_list va;
75 va_start(va, fmt);
76 vsnprintf(((char*) result->c_str()) + old_len, len + 1, fmt, va);
77 va_end(va);
78 }
79}
80
81
82} // namespace phxrpc

Callers 3

Calls 1

sizeMethod · 0.80

Tested by

no test coverage detected