]> code.citadel.org Git - citadel.git/blobdiff - citadel/sysdep.c
* sysdep.c: unbuffer_output(): Split the writing part to a new function
[citadel.git] / citadel / sysdep.c
index 8fb61866af905b81d3ebd1ee93774a3334bb5e11..5925aa6137bfcc3fb267e972a80d49db8945f3b8 100644 (file)
@@ -468,15 +468,24 @@ void buffer_output(void) {
 }
 
 /*
- * unbuffer_output()  ...  dump out all that output we've been buffering.
+ * flush_output()  ...   dump out all that output we've been buffering.
+ */
+void flush_output(void) {
+       if (CC->buffering == 1) {
+               client_write(CC->output_buffer, CC->buffer_len);
+               CC->buffer_len = 0;
+       }
+}
+
+/*
+ * unbuffer_output()  ...  stop buffering output.
  */
 void unbuffer_output(void) {
        if (CC->buffering == 1) {
+               flush_output();
                CC->buffering = 0;
-               client_write(CC->output_buffer, CC->buffer_len);
                free(CC->output_buffer);
                CC->output_buffer = NULL;
-               CC->buffer_len = 0;
        }
 }