X-Git-Url: http://git.tuebingen.mpg.de/?p=dss.git;a=blobdiff_plain;f=error.h;h=14cc032fae65f621ade9c419d682f0252b7ad0ac;hp=286db0e10dacdf7248f89a3e2f69b1b53125d210;hb=42451d3bbe741ebae3c8ad49aa104ae53efdbcdb;hpb=a6727ed6659f287eb2a4f68ac5fbf3178f40498f diff --git a/error.h b/error.h index 286db0e..14cc032 100644 --- a/error.h +++ b/error.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006-2008 Andre Noll + * Copyright (C) 2006-2010 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -21,20 +21,6 @@ __printf_2_3 void dss_log(int ll, const char* fmt,...); /** Set the system error bit for the given number. */ #define ERRNO_TO_DSS_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 dss' 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_DSS_ERROR(_errno) == num; -} - /** * dss' version of strerror(3). * @@ -52,33 +38,33 @@ static inline char *dss_strerror(int num) } #define DSS_ERRORS \ - DSS_ERROR(SUCCESS, "success") \ - DSS_ERROR(SYNTAX, "syntax error") \ - DSS_ERROR(ATOI_OVERFLOW, "value too large") \ - DSS_ERROR(STRTOLL, "unknown strtoll error") \ - DSS_ERROR(ATOI_NO_DIGITS, "no digits found in string") \ - DSS_ERROR(ATOI_JUNK_AT_END, "further characters after number") \ - DSS_ERROR(INVALID_NUMBER, "invalid number") \ - DSS_ERROR(STRFTIME, "strftime() failed") \ - DSS_ERROR(LOCALTIME, "localtime() failed") \ - DSS_ERROR(NULL_OPEN, "can not open /dev/null") \ - DSS_ERROR(DUP_PIPE, "exec error: can not create pipe") \ - DSS_ERROR(INVOLUNTARY_EXIT, "unexpected termination cause") \ - DSS_ERROR(BAD_EXIT_CODE, "unexpected exit code") \ - DSS_ERROR(SIGNAL_SIG_ERR, "signal() returned SIG_ERR") \ - DSS_ERROR(SIGNAL, "caught terminating signal") \ - DSS_ERROR(BUG, "values of beta might cause dom!") \ - + DSS_ERROR(SUCCESS, "success"), \ + DSS_ERROR(SYNTAX, "syntax error"), \ + DSS_ERROR(ATOI_OVERFLOW, "value too large"), \ + DSS_ERROR(STRTOLL, "unknown strtoll error"), \ + DSS_ERROR(ATOI_NO_DIGITS, "no digits found in string"), \ + DSS_ERROR(ATOI_JUNK_AT_END, "further characters after number"), \ + DSS_ERROR(INVALID_NUMBER, "invalid number"), \ + DSS_ERROR(STRFTIME, "strftime() failed"), \ + DSS_ERROR(LOCALTIME, "localtime() failed"), \ + DSS_ERROR(NULL_OPEN, "can not open /dev/null"), \ + DSS_ERROR(DUP_PIPE, "exec error: can not create pipe"), \ + DSS_ERROR(INVOLUNTARY_EXIT, "unexpected termination cause"), \ + DSS_ERROR(BAD_EXIT_CODE, "unexpected exit code"), \ + DSS_ERROR(SIGNAL_SIG_ERR, "signal() returned SIG_ERR"), \ + DSS_ERROR(SIGNAL, "caught terminating signal"), \ + DSS_ERROR(BUG, "values of beta might cause dom!"), \ + DSS_ERROR(NOT_RUNNING, "dss not running") /** * This is temporarily defined to expand to its first argument (prefixed by * 'E_') and gets later redefined to expand to the error text only */ -#define DSS_ERROR(err, msg) E_ ## err, +#define DSS_ERROR(err, msg) E_ ## err enum dss_error_codes { DSS_ERRORS }; #undef DSS_ERROR -#define DSS_ERROR(err, msg) msg, +#define DSS_ERROR(err, msg) msg #define DEFINE_DSS_ERRLIST char *dss_errlist[] = {DSS_ERRORS}