Gentoo Archives: gentoo-commits

From: Sven Eden <sven.eden@×××.de>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/ufed:master commit in: /
Date: Fri, 01 Feb 2013 10:49:53
Message-Id: 1359554309.6cdaf71f9178c057d8403468b78072c0fc2c14bb.yamakuzure@gentoo
1 commit: 6cdaf71f9178c057d8403468b78072c0fc2c14bb
2 Author: Sven Eden <sven.eden <AT> gmx <DOT> de>
3 AuthorDate: Wed Jan 30 13:58:29 2013 +0000
4 Commit: Sven Eden <sven.eden <AT> gmx <DOT> de>
5 CommitDate: Wed Jan 30 13:58:29 2013 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=6cdaf71f
7
8 Moved debugging macros to the new header ufed-debug.h
9
10 ---
11 ufed-debug.h | 40 ++++++++++++++++++++++++++++++++++++++++
12 1 files changed, 40 insertions(+), 0 deletions(-)
13
14 diff --git a/ufed-debug.h b/ufed-debug.h
15 new file mode 100644
16 index 0000000..67bbf2c
17 --- /dev/null
18 +++ b/ufed-debug.h
19 @@ -0,0 +1,40 @@
20 +/*
21 + * ufed-debug.h
22 + *
23 + * Created on: 28.01.2013
24 + * Author: Sven Eden
25 + */
26 +#pragma once
27 +#ifndef UFED_DEBUG_H_INCLUDED
28 +#define UFED_DEBUG_H_INCLUDED 1
29 +
30 +/* These are debugging macros that can be turned on/off by
31 + * defining/undefining their guards.
32 + */
33 +#define DEBUG_EXIT 1 /* If defined ERROR_EXIT() prints an error message */
34 +#undef DEBUG_TRACE /* If defined TRACE() prints current file, line, function */
35 +
36 +// DEBUG_EXIT -> ERROR_EXIT() macro
37 +#if defined(DEBUG_EXIT)
38 +# define ERROR_EXIT(code, fmt, ...) { \
39 + cursesdone(); \
40 + fprintf(stderr, "\nERROR in %s:%d (%s): \n -> ", \
41 + __FILE__, __LINE__, __FUNCTION__); \
42 + fprintf(stderr, fmt, __VA_ARGS__); \
43 + exit(code); \
44 +}
45 +#else
46 +# define ERROR_EXIT(code, ...) { cursesdone(); exit(code); }
47 +#endif // DEBUG_EXIT
48 +
49 +// DEBUG_TRACE -> TRACE macro
50 +#if defined(DEBUG_TRACE)
51 +# define TRACE { \
52 + fprintf(stderr, "(TRACE) %s:%d - %s\n", __FILE__, __LINE__, __FUNCTION__); \
53 +}
54 +#else
55 +# define TRACE
56 +#endif // DEBUG_TRACE
57 +
58 +
59 +#endif /* UFED_DEBUG_H_INCLUDED */