debug.c 510 字节
Newer Older
1 2 3 4 5 6 7 8
/* For general debugging purposes */

#include "../perf.h"
#include <string.h>
#include <stdarg.h>
#include <stdio.h>

int verbose = 0;
9
int dump_trace = 0;
10 11 12 13 14 15 16 17 18 19 20 21 22 23

int eprintf(const char *fmt, ...)
{
	va_list args;
	int ret = 0;

	if (verbose) {
		va_start(args, fmt);
		ret = vfprintf(stderr, fmt, args);
		va_end(args);
	}

	return ret;
}
24 25 26 27 28 29 30 31 32 33 34 35 36 37

int dump_printf(const char *fmt, ...)
{
	va_list args;
	int ret = 0;

	if (dump_trace) {
		va_start(args, fmt);
		ret = vprintf(fmt, args);
		va_end(args);
	}

	return ret;
}