aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcus Brinkmann <[email protected]>2003-05-25 23:56:13 +0000
committerMarcus Brinkmann <[email protected]>2003-05-25 23:56:13 +0000
commit8ec597cde3d8252659ec36592552f4af2e89ed6c (patch)
tree6840e04e8eda2fd567b0e05b537f44d00b76007c
parent2003-05-15 Marcus Brinkmann <[email protected]> (diff)
downloadlibgpg-error-8ec597cde3d8252659ec36592552f4af2e89ed6c.tar.gz
libgpg-error-8ec597cde3d8252659ec36592552f4af2e89ed6c.zip
2003-05-26 Marcus Brinkmann <[email protected]>
* 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.
-rw-r--r--ChangeLog6
-rw-r--r--src/gpg/error.h5
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 <[email protected]>
+
+ * 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 <[email protected]>
* 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));
}