ac-power: define main through macro
I decided to use a separate definition for this because it's too easy to return positive from functions which don't need this distinction and only return negative on error and success otherwise.
This commit is contained in:
@@ -515,4 +515,14 @@ static inline int __coverity_check__(int condition) {
|
||||
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS; \
|
||||
}
|
||||
|
||||
/* Zero is mapped to EXIT_SUCCESS, and both negative and positive values
|
||||
* are mapped to EXIT_FAILURE.
|
||||
* Note: this means "true" maps to EXIT_FAILURE. */
|
||||
#define DEFINE_MAIN_FUNCTION_WITH_POSITIVE_FAILURE(impl) \
|
||||
int main(int argc, char *argv[]) { \
|
||||
int r; \
|
||||
r = impl(argc, argv); \
|
||||
return r != 0 ? EXIT_FAILURE : EXIT_SUCCESS; \
|
||||
}
|
||||
|
||||
#include "log.h"
|
||||
|
||||
Reference in New Issue
Block a user