MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / mi_out_buf

Function mi_out_buf

3rd/mimalloc-2.0.9/src/options.c:221–235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

219static _Atomic(size_t) out_len;
220
221static void mi_cdecl mi_out_buf(const char* msg, void* arg) {
222 MI_UNUSED(arg);
223 if (msg==NULL) return;
224 if (mi_atomic_load_relaxed(&out_len)>=MI_MAX_DELAY_OUTPUT) return;
225 size_t n = strlen(msg);
226 if (n==0) return;
227 // claim space
228 size_t start = mi_atomic_add_acq_rel(&out_len, n);
229 if (start >= MI_MAX_DELAY_OUTPUT) return;
230 // check bound
231 if (start+n >= MI_MAX_DELAY_OUTPUT) {
232 n = MI_MAX_DELAY_OUTPUT-start-1;
233 }
234 _mi_memcpy(&out_buf[start], msg, n);
235}
236
237static void mi_out_buf_flush(mi_output_fun* out, bool no_more_buf, void* arg) {
238 if (out==NULL) return;

Callers 1

mi_out_buf_stderrFunction · 0.85

Calls 1

_mi_memcpyFunction · 0.85

Tested by

no test coverage detected