debug.c 510 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /* For general debugging purposes */
  2. #include "../perf.h"
  3. #include <string.h>
  4. #include <stdarg.h>
  5. #include <stdio.h>
  6. int verbose = 0;
  7. int dump_trace = 0;
  8. int eprintf(const char *fmt, ...)
  9. {
  10. va_list args;
  11. int ret = 0;
  12. if (verbose) {
  13. va_start(args, fmt);
  14. ret = vfprintf(stderr, fmt, args);
  15. va_end(args);
  16. }
  17. return ret;
  18. }
  19. int dump_printf(const char *fmt, ...)
  20. {
  21. va_list args;
  22. int ret = 0;
  23. if (dump_trace) {
  24. va_start(args, fmt);
  25. ret = vprintf(fmt, args);
  26. va_end(args);
  27. }
  28. return ret;
  29. }