From 22abcc2013d2f68ec55e5e0113c682899662c7d7 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Thu, 11 Jun 2009 23:52:20 +0200 Subject: [PATCH] Kill error.h. This completes the cleanup of the error handling. --- error.h | 28 ---------------------------- fsck.c | 2 +- osl.c | 3 --- util.c | 1 - 4 files changed, 1 insertion(+), 33 deletions(-) delete mode 100644 error.h diff --git a/error.h b/error.h deleted file mode 100644 index f28c39d..0000000 --- a/error.h +++ /dev/null @@ -1,28 +0,0 @@ -#define FSCK_ERROR_BIT 29 -/** - * This bit indicates whether a number is considered a system error number - * If yes, the system errno is just the result of clearing this bit from - * the given number. - */ -#define SYSTEM_ERROR_BIT 30 - -/** Check whether the system error bit is set. */ -#define IS_SYSTEM_ERROR(num) (!!((num) & (1 << SYSTEM_ERROR_BIT))) - -/** Set the system error bit for the given number. */ -#define ERRNO_TO_ERROR(num) ((num) | (1 << SYSTEM_ERROR_BIT)) - -/** - * Check whether a given number is a system error number. - * - * \param num The value to be checked. - * \param _errno The system error number. - * - * \return True if \a num is the representation of the system - * error identified by \a _errno. - */ -static inline int is_errno(int num, int _errno) -{ - assert(num > 0 && _errno > 0); - return ERRNO_TO_ERROR(_errno) == num; -} diff --git a/fsck.c b/fsck.c index e623b37..bd1b556 100644 --- a/fsck.c +++ b/fsck.c @@ -14,7 +14,6 @@ #include "log.h" #include "osl.h" -#include "error.h" #include "util.h" #include "osl_core.h" #include "fsck.cmdline.h" @@ -44,6 +43,7 @@ static struct fsck_args_info conf; FSCK_ERROR(CHDIR, "could not change directory"), \ FSCK_ERROR(OPENDIR, "could not open directory"), +#define FSCK_ERROR_BIT 29 #define FSCK_ERROR(num, txt) E_FSCK_ ## num enum { FSCK_DUMMY = (1 << FSCK_ERROR_BIT) - 1, diff --git a/osl.c b/osl.c index eb1d24f..5b9308e 100644 --- a/osl.c +++ b/osl.c @@ -10,7 +10,6 @@ #include "log.h" #include "osl.h" -#include "error.h" #include "util.h" #include "osl_core.h" @@ -38,8 +37,6 @@ static const unsigned int errmsgidx[] = { __export const char *osl_strerror(int num) { - if (IS_SYSTEM_ERROR(num)) - return strerror((num) & ((1 << SYSTEM_ERROR_BIT) - 1)); return msgstr.str + errmsgidx[num]; } diff --git a/util.c b/util.c index 79b4944..7500c08 100644 --- a/util.c +++ b/util.c @@ -14,7 +14,6 @@ #include "log.h" #include "osl.h" -#include "error.h" #include "util.h" /** -- 2.39.5