Parolin 0.7.9 6796
Console (soon DLLs) to do a tar like job
Loading...
Searching...
No Matches
error_private.h File Reference
#include "../zstd_errors.h"
#include "compiler.h"
#include "debug.h"
#include "zstd_deps.h"

Go to the source code of this file.

Macros

#define ERR_STATIC   static /* this version may generate warnings for unused static functions; disable the relevant warning */
 
#define PREFIX(name)
 
#define ERROR(name)
 
#define ZSTD_ERROR(name)
 
#define CHECK_V_F(e, f)
 
#define CHECK_F(f)
 
#define _FORCE_HAS_FORMAT_STRING(...)
 
#define ERR_QUOTE(str)
 
#define RETURN_ERROR_IF(cond, err, ...)
 
#define RETURN_ERROR(err, ...)
 
#define FORWARD_IF_ERROR(err, ...)
 

Functions

ERR_STATIC unsigned ERR_isError (size_t code)
 
ERR_STATIC ERR_enum ERR_getErrorCode (size_t code)
 
const char * ERR_getErrorString (ERR_enum code)
 
ERR_STATIC const char * ERR_getErrorName (size_t code)
 

Macro Definition Documentation

◆ _FORCE_HAS_FORMAT_STRING

#define _FORCE_HAS_FORMAT_STRING ( ...)
Value:
if (0) { \
_force_has_format_string(__VA_ARGS__); \
}

Ignore: this is an internal helper.

We want to force this function invocation to be syntactically correct, but we don't want to force runtime evaluation of its arguments.

◆ CHECK_F

#define CHECK_F ( f)
Value:
{ CHECK_V_F(_var_err__, f); }
#define f(i)
Definition sha256.c:46
#define CHECK_V_F(e, f)
Definition error_private.h:63

◆ CHECK_V_F

#define CHECK_V_F ( e,
f )
Value:
size_t const e = f; if (ERR_isError(e)) return e
#define e(i)
Definition sha256.c:45
ERR_STATIC unsigned ERR_isError(size_t code)
Definition error_private.h:58

◆ ERR_QUOTE

#define ERR_QUOTE ( str)
Value:
#str

◆ ERR_STATIC

#define ERR_STATIC   static /* this version may generate warnings for unused static functions; disable the relevant warning */

◆ ERROR

#define ERROR ( name)
Value:
char name[NAME_LEN_MAX+1]
Name of the filter.
Definition string_conversion.c:450
#define ZSTD_ERROR(name)
Definition error_private.h:56

◆ FORWARD_IF_ERROR

#define FORWARD_IF_ERROR ( err,
... )
Value:
do { \
size_t const err_code = (err); \
if (ERR_isError(err_code)) { \
RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s", \
__FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
_FORCE_HAS_FORMAT_STRING(__VA_ARGS__); \
RAWLOG(3, ": " __VA_ARGS__); \
RAWLOG(3, "\n"); \
return err_code; \
} \
} while(0);
#define ERR_QUOTE(str)
Definition error_private.h:103
ERR_STATIC const char * ERR_getErrorName(size_t code)
Definition error_private.h:73

If the provided expression evaluates to an error code, returns that error code.

In debug modes, prints additional information.

◆ PREFIX

#define PREFIX ( name)
Value:
ZSTD_error_##name

◆ RETURN_ERROR

#define RETURN_ERROR ( err,
... )
Value:
do { \
RAWLOG(3, "%s:%d: ERROR!: unconditional check failed, returning %s", \
__FILE__, __LINE__, ERR_QUOTE(ERROR(err))); \
_FORCE_HAS_FORMAT_STRING(__VA_ARGS__); \
RAWLOG(3, ": " __VA_ARGS__); \
RAWLOG(3, "\n"); \
return ERROR(err); \
} while(0);
#define ERROR(name)
Definition error_private.h:55

Unconditionally return the specified error.

In debug modes, prints additional information.

◆ RETURN_ERROR_IF

#define RETURN_ERROR_IF ( cond,
err,
... )
Value:
if (cond) { \
RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s", \
__FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
_FORCE_HAS_FORMAT_STRING(__VA_ARGS__); \
RAWLOG(3, ": " __VA_ARGS__); \
RAWLOG(3, "\n"); \
return ERROR(err); \
}

Return the specified error if the condition evaluates to true.

In debug modes, prints additional information. In order to do that (particularly, printing the conditional that failed), this can't just wrap RETURN_ERROR().

◆ ZSTD_ERROR

#define ZSTD_ERROR ( name)
Value:
((size_t)-PREFIX(name))
#define PREFIX(name)
Definition error_private.h:48

Function Documentation

◆ ERR_getErrorCode()

ERR_STATIC ERR_enum ERR_getErrorCode ( size_t code)

◆ ERR_getErrorName()

ERR_STATIC const char * ERR_getErrorName ( size_t code)

◆ ERR_getErrorString()

const char * ERR_getErrorString ( ERR_enum code)

◆ ERR_isError()

ERR_STATIC unsigned ERR_isError ( size_t code)