MCPcopy Create free account
hub / github.com/appdevforall/CodeOnTheGo / string_format

Function string_format

subprojects/llama.cpp/tools/mtmd/clip-impl.h:406–419  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

404//
405
406static std::string string_format(const char * fmt, ...) {
407 va_list ap;
408 va_list ap2;
409 va_start(ap, fmt);
410 va_copy(ap2, ap);
411 int size = vsnprintf(NULL, 0, fmt, ap);
412 GGML_ASSERT(size >= 0 && size < INT_MAX); // NOLINT
413 std::vector<char> buf(size + 1);
414 int size2 = vsnprintf(buf.data(), size + 1, fmt, ap2);
415 GGML_ASSERT(size2 == size);
416 va_end(ap2);
417 va_end(ap);
418 return std::string(buf.data(), buf.size());
419}
420
421static void string_replace_all(std::string & s, const std::string & search, const std::string & replace) {
422 if (search.empty()) {

Callers 12

gguf_data_to_strFunction · 0.70
clip_model_loaderMethod · 0.70
load_hparamsMethod · 0.70
load_tensorsMethod · 0.70
mtmd_contextMethod · 0.70
parse_devices_argFunction · 0.50
update_slotsMethod · 0.50
init_routesMethod · 0.50
add_modelMethod · 0.50
load_modelsMethod · 0.50
router_validate_modelFunction · 0.50
startMethod · 0.50

Calls 3

stringClass · 0.85
sizeMethod · 0.65
dataMethod · 0.45

Tested by

no test coverage detected