From 26c029b7a227c741ccf345ee34e199bc4b6cde01 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Wed, 5 Jun 2019 15:10:48 -0700 Subject: [PATCH] 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 de07d533..6c6c01a0 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;