2 Copyright (c) 2010 Frank Lahm <franklahm@gmail.com>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
18 #define EC_INIT int ret = 0
19 #define EC_CLEANUP cleanup
20 #define EC_EXIT return ret
23 * We have these macros:
32 /* check for return val 0 which is ok, every other is an error, prints errno */
33 #define EC_ZERO_PRINT(a) \
36 LOG(log_error, logtype_default, "%s failed: %s" #a, strerror(errno)); \
42 /* check for return val 0 which is ok, every other is an error */
51 /* check for return val 0 which is ok, every other is an error, prints errno */
52 #define EC_NEG1_PRINT(a) \
55 LOG(log_error, logtype_default, "%s failed: %s" #a, strerror(errno)); \
61 /* check for return val 0 which is ok, every other is an error */
70 /* check for return val != NULL, prints errno */
71 #define EC_NULL_PRINT(a) \
74 LOG(log_error, logtype_default, "%s failed: %s" #a, strerror(errno)); \
80 /* check for return val != NULL */
89 #endif /* ERRCHECK_H */