From 8ec597cde3d8252659ec36592552f4af2e89ed6c Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Sun, 25 May 2003 23:56:13 +0000 Subject: 2003-05-26 Marcus Brinkmann * src/gpg/error.h (gpg_make_error): Only OR in the error source if there is an error, this allows to test for success with "if (!err)" and similar tests. --- ChangeLog | 6 ++++++ src/gpg/error.h | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index e047951..8b92bcb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2003-05-26 Marcus Brinkmann + + * src/gpg/error.h (gpg_make_error): Only OR in the error source if + there is an error, this allows to test for success with "if (!err)" + and similar tests. + 2003-05-15 Marcus Brinkmann * src/mkstrtable.awk: Add exception clause to license about the diff --git a/src/gpg/error.h b/src/gpg/error.h index 990a265..1803cfe 100644 --- a/src/gpg/error.h +++ b/src/gpg/error.h @@ -241,8 +241,9 @@ typedef unsigned long gpg_error_t; static __inline__ gpg_error_t gpg_make_error (gpg_err_source_t source, gpg_err_code_t code) { - return ((source & GPG_ERR_SOURCE_MASK) << GPG_ERR_SOURCE_SHIFT) - | (code & GPG_ERR_CODE_MASK); + return code == GPG_ERR_NO_ERROR ? GPG_ERR_NO_ERROR + : (((source & GPG_ERR_SOURCE_MASK) << GPG_ERR_SOURCE_SHIFT) + | (code & GPG_ERR_CODE_MASK)); } -- cgit v1.2.3