MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / string_format

Function string_format

smallthinker/common/common.cpp:388–401  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

386//
387
388std::string string_format(const char * fmt, ...) {
389 va_list ap;
390 va_list ap2;
391 va_start(ap, fmt);
392 va_copy(ap2, ap);
393 int size = vsnprintf(NULL, 0, fmt, ap);
394 GGML_ASSERT(size >= 0 && size < INT_MAX); // NOLINT
395 std::vector<char> buf(size + 1);
396 int size2 = vsnprintf(buf.data(), size + 1, fmt, ap2);
397 GGML_ASSERT(size2 == size);
398 va_end(ap2);
399 va_end(ap);
400 return std::string(buf.data(), size);
401}
402
403std::string string_strip(const std::string & str) {
404 size_t start = 0;

Callers 6

read_fileFunction · 0.70
write_fileFunction · 0.70
common_get_hf_fileFunction · 0.70
common_params_parse_exFunction · 0.70
parse_device_listFunction · 0.70

Calls 2

stringClass · 0.50
dataMethod · 0.45

Tested by

no test coverage detected