MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / format_with_commas

Function format_with_commas

src/misc/alloc_tracker.cpp:339–351  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

337}
338
339static void format_with_commas(char *buf, size_t buflen, uint64_t v) {
340 char tmp[32];
341 int n = snprintf(tmp, sizeof(tmp), "%llu", (unsigned long long)v);
342 int out = 0;
343 for (int i = 0; i < n && out < (int)buflen - 1; ++i) {
344 int remaining = n - i;
345 if (i > 0 && (remaining % 3) == 0) {
346 if (out < (int)buflen - 1) buf[out++] = ',';
347 }
348 buf[out++] = tmp[i];
349 }
350 buf[out] = 0;
351}
352
353size_t dump_alloc_leaks(FILE *out) {
354 // Disarm so fprintf/Sym*/etc don't churn the map during the dump.

Callers 1

dump_alloc_leaksFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected