common/iobuf.c:iobuf_write_temp: Elide redundant code.
authorNeal H. Walfield <neal@g10code.com>
Mon, 17 Aug 2015 10:40:53 +0000 (12:40 +0200)
committerNeal H. Walfield <neal@g10code.com>
Thu, 20 Aug 2015 12:16:26 +0000 (14:16 +0200)
* common/iobuf.c (iobuf_write_temp): Don't repeat iobuf_flush_temp.
Use it directly.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>.
common/iobuf.c

index 4674fdf..7699262 100644 (file)
@@ -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