MCPcopy Create free account
hub / github.com/beefytech/Beef / malloc_vsnprintf

Function malloc_vsnprintf

BeefRT/JEMalloc/src/malloc_io.c:324–366  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

322}
323
324JEMALLOC_COLD
325size_t
326malloc_vsnprintf(char *str, size_t size, const char *format, va_list ap) {
327 size_t i;
328 const char *f;
329
330#define APPEND_C(c) do { \
331 if (i < size) { \
332 str[i] = (c); \
333 } \
334 i++; \
335} while (0)
336#define APPEND_S(s, slen) do { \
337 if (i < size) { \
338 size_t cpylen = (slen <= size - i) ? slen : size - i; \
339 memcpy(&str[i], s, cpylen); \
340 } \
341 i += slen; \
342} while (0)
343#define APPEND_PADDED_S(s, slen, width, left_justify) do { \
344 /* Left padding. */ \
345 size_t pad_len = (width == -1) ? 0 : ((slen < (size_t)width) ? \
346 (size_t)width - slen : 0); \
347 if (!left_justify && pad_len != 0) { \
348 size_t j; \
349 for (j = 0; j < pad_len; j++) { \
350 if (pad_zero) { \
351 APPEND_C('0'); \
352 } else { \
353 APPEND_C(' '); \
354 } \
355 } \
356 } \
357 /* Value. */ \
358 APPEND_S(s, slen); \
359 /* Right padding. */ \
360 if (left_justify && pad_len != 0) { \
361 size_t j; \
362 for (j = 0; j < pad_len; j++) { \
363 APPEND_C(' '); \
364 } \
365 } \
366} while (0)
367#define GET_ARG_NUMERIC(val, len) do { \
368 switch ((unsigned char)len) { \
369 case '?': \

Callers 6

safety_check_failFunction · 0.85
prof_open_maps_internalFunction · 0.85
prof_dump_printfFunction · 0.85
malloc_io.cFile · 0.85
log_impl_varargsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected