MCPcopy Index your code
hub / github.com/GJDuck/e9patch / debug_impl

Function debug_impl

examples/stdlib.c:1028–1042  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1026static int vsnprintf(char *str, size_t size, const char *format, va_list ap);
1027
1028static __attribute__((__noinline__)) void debug_impl(const char *format, ...)
1029{
1030 va_list ap, ap2;
1031 va_start(ap, format);
1032 va_copy(ap2, ap);
1033 int n = vsnprintf(NULL, 0, format, ap);
1034 if (n >= 0)
1035 {
1036 char buf[n+1];
1037 int r = vsnprintf(buf, sizeof(buf), format, ap2);
1038 if (r == n)
1039 write(STDERR_FILENO, buf, n);
1040 }
1041 va_end(ap);
1042}
1043
1044#define debug(format, ...) \
1045 debug_impl("\33[35mdebug\33[0m: " __FILE__ ": " STRING(__LINE__) ": " \

Callers

nothing calls this directly

Calls 2

vsnprintfFunction · 0.70
writeFunction · 0.70

Tested by

no test coverage detected