[Pkg-gnupg-commit] [libgpg-error] 16/35: estream: Remove strange macro for better readability.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Mon Apr 25 21:47:12 UTC 2016


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch master
in repository libgpg-error.

commit 217a451d54186283f09af5b3c03933f214ddf1c0
Author: Werner Koch <wk at gnupg.org>
Date:   Tue Mar 29 16:36:44 2016 +0200

    estream: Remove strange macro for better readability.
    
    * src/estream.c (SET_UNLESS_NONZERO): Remove macro.
    (es_deinitialize): Replace that macro by direct code.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>
---
 src/estream.c | 26 +++++++++++---------------
 1 file changed, 11 insertions(+), 15 deletions(-)

diff --git a/src/estream.c b/src/estream.c
index abce0bf..4564b27 100644
--- a/src/estream.c
+++ b/src/estream.c
@@ -248,18 +248,6 @@ static void fname_set_internal (estream_t stream, const char *fname, int quote);
 #define tohex(n) ((n) < 10 ? ((n) + '0') : (((n) - 10) + 'A'))
 
 
-/* Evaluate EXPRESSION, setting VARIABLE to the return code, if
-   VARIABLE is zero.  */
-#define SET_UNLESS_NONZERO(variable, tmp_variable, expression) \
-  do                                                           \
-    {                                                          \
-      tmp_variable = expression;                               \
-      if ((! variable) && tmp_variable)                        \
-        variable = tmp_variable;                               \
-    }                                                          \
-  while (0)
-
-
 

 static void *
 mem_alloc (size_t n)
@@ -1884,9 +1872,17 @@ es_deinitialize (estream_t stream)
 
   err = 0;
   if (stream->flags.writing)
-    SET_UNLESS_NONZERO (err, tmp_err, es_flush (stream));
+    {
+      tmp_err = es_flush (stream);
+      if (!err)
+        err = tmp_err;
+    }
   if (func_close)
-    SET_UNLESS_NONZERO (err, tmp_err, (*func_close) (stream->intern->cookie));
+    {
+      tmp_err = func_close (stream->intern->cookie);
+      if (!err)
+        err = tmp_err;
+    }
 
   mem_free (stream->intern->printable_fname);
   stream->intern->printable_fname = NULL;
@@ -4483,7 +4479,7 @@ _gpgrt_get_nonblock (estream_t stream)
 
 /* A version of poll(2) working on estream handles.  Note that not all
    estream types work with this function.  In contrast to the standard
-   poll function the gpgrt_poll_t object uses a set of names bit flags
+   poll function the gpgrt_poll_t object uses a set of bit flags
    instead of the EVENTS and REVENTS members.  An item with the IGNORE
    flag set is entirely ignored.  The TIMEOUT values is given in
    milliseconds, a value of -1 waits indefinitely, and a value of 0

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/libgpg-error.git



More information about the Pkg-gnupg-commit mailing list