[sysprof] libsysprof-capture: short-circuit empty write



commit 26c029b7a227c741ccf345ee34e199bc4b6cde01
Author: Christian Hergert <chergert redhat com>
Date:   Wed Jun 5 15:10:48 2019 -0700

    libsysprof-capture: short-circuit empty write

 src/libsysprof-capture/sysprof-capture-writer.c | 3 +++
 1 file changed, 3 insertions(+)
---
diff --git a/src/libsysprof-capture/sysprof-capture-writer.c b/src/libsysprof-capture/sysprof-capture-writer.c
index de07d53..6c6c01a 100644
--- a/src/libsysprof-capture/sysprof-capture-writer.c
+++ b/src/libsysprof-capture/sysprof-capture-writer.c
@@ -203,6 +203,9 @@ sysprof_capture_writer_flush_data (SysprofCaptureWriter *self)
   g_assert (self->pos <= self->len);
   g_assert ((self->pos % SYSPROF_CAPTURE_ALIGN) == 0);
 
+  if (self->pos == 0)
+    return TRUE;
+
   buf = self->buf;
   to_write = self->pos;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]