diff options
author | Conrad Meyer <cem@FreeBSD.org> | 2020-05-23 20:37:33 +0000 |
---|---|---|
committer | Conrad Meyer <cem@FreeBSD.org> | 2020-05-23 20:37:33 +0000 |
commit | bc64b5ce191d48b503e4fad8c0cefb774a2fa969 (patch) | |
tree | 9b41925d7159f1f57c1b59a1a5f887c80a57e999 /lib/common/error_private.h | |
parent | ea68403922c3b53b00fc999fcb3eaef1feb50177 (diff) |
Notes
Diffstat (limited to 'lib/common/error_private.h')
-rw-r--r-- | lib/common/error_private.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/common/error_private.h b/lib/common/error_private.h index 0d2fa7e34b014..982cf8e9fe6f8 100644 --- a/lib/common/error_private.h +++ b/lib/common/error_private.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. + * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -49,7 +49,7 @@ typedef ZSTD_ErrorCode ERR_enum; /*-**************************************** * Error codes handling ******************************************/ -#undef ERROR /* reported already defined on VS 2015 (Rich Geldreich) */ +#undef ERROR /* already defined on Visual Studio */ #define ERROR(name) ZSTD_ERROR(name) #define ZSTD_ERROR(name) ((size_t)-PREFIX(name)) @@ -57,6 +57,10 @@ ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); } ERR_STATIC ERR_enum ERR_getErrorCode(size_t code) { if (!ERR_isError(code)) return (ERR_enum)0; return (ERR_enum) (0-code); } +/* check and forward error code */ +#define CHECK_V_F(e, f) size_t const e = f; if (ERR_isError(e)) return e +#define CHECK_F(f) { CHECK_V_F(_var_err__, f); } + /*-**************************************** * Error Strings |