libmu_sieve: cleanup
* libmu_sieve/actions.c (mime_create_quote): Use mu_stream_copy.
Showing
1 changed file
with
3 additions
and
11 deletions
... | @@ -242,10 +242,8 @@ mime_create_quote (mu_mime_t mime, mu_message_t msg) | ... | @@ -242,10 +242,8 @@ mime_create_quote (mu_mime_t mime, mu_message_t msg) |
242 | mu_message_t newmsg; | 242 | mu_message_t newmsg; |
243 | mu_stream_t istream, ostream; | 243 | mu_stream_t istream, ostream; |
244 | mu_header_t hdr; | 244 | mu_header_t hdr; |
245 | size_t n; | ||
246 | char buffer[512]; | ||
247 | mu_body_t body; | ||
248 | int rc; | 245 | int rc; |
246 | mu_body_t body; | ||
249 | 247 | ||
250 | mu_message_create (&newmsg, NULL); | 248 | mu_message_create (&newmsg, NULL); |
251 | mu_message_get_header (newmsg, &hdr); | 249 | mu_message_get_header (newmsg, &hdr); |
... | @@ -254,14 +252,8 @@ mime_create_quote (mu_mime_t mime, mu_message_t msg) | ... | @@ -254,14 +252,8 @@ mime_create_quote (mu_mime_t mime, mu_message_t msg) |
254 | mu_body_get_streamref (body, &ostream); | 252 | mu_body_get_streamref (body, &ostream); |
255 | mu_message_get_streamref (msg, &istream); | 253 | mu_message_get_streamref (msg, &istream); |
256 | 254 | ||
257 | rc = 0;/* FIXME: use mu_stream_copy */ | 255 | rc = mu_stream_copy (ostream, istream, 0); |
258 | while (mu_stream_read (istream, buffer, sizeof buffer - 1, &n) == 0 | 256 | |
259 | && n != 0) | ||
260 | { | ||
261 | rc = mu_stream_write (ostream, buffer, n, NULL); | ||
262 | if (rc) | ||
263 | break; | ||
264 | } | ||
265 | mu_stream_destroy (&istream); | 257 | mu_stream_destroy (&istream); |
266 | mu_stream_close (ostream); | 258 | mu_stream_close (ostream); |
267 | mu_stream_destroy (&ostream); | 259 | mu_stream_destroy (&ostream); | ... | ... |
-
Please register or sign in to post a comment