summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@g10code.com>2015-08-17 12:40:53 +0200
committerNeal H. Walfield <neal@g10code.com>2015-08-20 14:16:26 +0200
commite291b631c3b1aedf529078190cd51e2acfcd1d92 (patch)
treea5aa12770bc4117d842f0e43cc6b8a9406fe73a8 /common
parentcommon/iobuf.c: Have iobuf_writestr use iobuf_write, not iobuf_writebyte (diff)
downloadgnupg2-e291b631c3b1aedf529078190cd51e2acfcd1d92.tar.xz
gnupg2-e291b631c3b1aedf529078190cd51e2acfcd1d92.zip
common/iobuf.c:iobuf_write_temp: Elide redundant code.
* common/iobuf.c (iobuf_write_temp): Don't repeat iobuf_flush_temp. Use it directly. -- Signed-off-by: Neal H. Walfield <neal@g10code.com>.
Diffstat (limited to 'common')
-rw-r--r--common/iobuf.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/common/iobuf.c b/common/iobuf.c
index 4674fdf15..769926234 100644
--- a/common/iobuf.c
+++ b/common/iobuf.c
@@ -2114,11 +2114,13 @@ iobuf_writestr (iobuf_t a, const char *buf)
int
-iobuf_write_temp (iobuf_t a, iobuf_t temp)
+iobuf_write_temp (iobuf_t dest, iobuf_t source)
{
- while (temp->chain)
- pop_filter (temp, temp->filter, NULL);
- return iobuf_write (a, temp->d.buf, temp->d.len);
+ assert (source->use == IOBUF_OUTPUT || source->use == IOBUF_TEMP);
+ assert (dest->use == IOBUF_OUTPUT || dest->use == IOBUF_TEMP);
+
+ iobuf_flush_temp (source);
+ return iobuf_write (dest, source->d.buf, source->d.len);
}
size_t