aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2016-03-29 14:36:44 +0000
committerWerner Koch <[email protected]>2016-03-29 14:37:03 +0000
commit217a451d54186283f09af5b3c03933f214ddf1c0 (patch)
tree62e70c6f7fda6710c2e1079c65d38cd137c30e92
parentAdd function gpgrt_annotate_leaked_object. (diff)
downloadlibgpg-error-217a451d54186283f09af5b3c03933f214ddf1c0.tar.gz
libgpg-error-217a451d54186283f09af5b3c03933f214ddf1c0.zip
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 <[email protected]>
-rw-r--r--src/estream.c26
1 files 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