MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / format

Function format

test/test_emscripten_async_wget2.cpp:155–171  ·  view source on GitHub ↗

this is safe and convenient but not exactly efficient

Source from the content-addressed store, hash-verified

153
154// this is safe and convenient but not exactly efficient
155inline std::string format(const char* fmt, ...){
156 int size = 512;
157 char* buffer = 0;
158 buffer = new char[size];
159 va_list vl;
160 va_start(vl,fmt);
161 int nsize = vsnprintf(buffer, size, fmt, vl);
162 if (size <= nsize) {// fail delete buffer and try again
163 delete buffer; buffer = 0;
164 buffer = new char[nsize+1];//+1 for /0
165 nsize = vsnprintf(buffer, size, fmt, vl);
166 }
167 std::string ret(buffer);
168 va_end(vl);
169 delete buffer;
170 return ret;
171}
172
173int http::uid = 0;
174

Callers 1

runRequestMethod · 0.70

Calls 1

vsnprintfFunction · 0.85

Tested by

no test coverage detected