diff options
author | norly <ny-git@enpas.org> | 2013-05-24 01:07:45 +0100 |
---|---|---|
committer | norly <ny-git@enpas.org> | 2013-05-24 01:08:56 +0100 |
commit | bac8986954899053330a952cb6e40d04ec1225b8 (patch) | |
tree | 0359885c1cb848b54489f8d8421d5c09edeea592 /include/libelfu | |
parent | 2e60e5b7733fbb99009421ca84a5e3cdc49e7fa7 (diff) |
Cleaner error handling with ELFU_WARN and ELFU_WARNELF
Diffstat (limited to 'include/libelfu')
-rw-r--r-- | include/libelfu/debug.h | 11 | ||||
-rw-r--r-- | include/libelfu/libelfu.h | 1 |
2 files changed, 12 insertions, 0 deletions
diff --git a/include/libelfu/debug.h b/include/libelfu/debug.h new file mode 100644 index 0000000..4c82345 --- /dev/null +++ b/include/libelfu/debug.h @@ -0,0 +1,11 @@ +#ifndef __LIBELFU_DEBUG_H_ +#define __LIBELFU_DEBUG_H_ + +#include <stdio.h> + + +#define ELFU_WARN(...) do { fprintf(stderr, __VA_ARGS__); } while(0) + +#define ELFU_WARNELF(function_name) ELFU_WARN(function_name "() failed: %s\n", elf_errmsg(-1)) + +#endif diff --git a/include/libelfu/libelfu.h b/include/libelfu/libelfu.h index 1fc613a..cc55282 100644 --- a/include/libelfu/libelfu.h +++ b/include/libelfu/libelfu.h @@ -9,5 +9,6 @@ #include <libelfu/modeltypes.h> #include <libelfu/modelops.h> +#include <libelfu/debug.h> #endif |