From 3446628cecb2c341ab1ee620f25ce0d5384e5519 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Thu, 2 Jul 2020 11:00:14 +0100 Subject: [PATCH] libsysprof-capture: Use offsetof() rather than G_STRUCT_OFFSET() It does the same for modern compilers. Signed-off-by: Philip Withnall Helps: #40 --- src/libsysprof-capture/sysprof-capture-writer-cat.c | 2 +- src/libsysprof-capture/sysprof-capture-writer.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libsysprof-capture/sysprof-capture-writer-cat.c b/src/libsysprof-capture/sysprof-capture-writer-cat.c index 3fbd5858..cec252a6 100644 --- a/src/libsysprof-capture/sysprof-capture-writer-cat.c +++ b/src/libsysprof-capture/sysprof-capture-writer-cat.c @@ -366,7 +366,7 @@ sysprof_capture_writer_cat (SysprofCaptureWriter *self, frame->frame.pid, frame->id, frame->metadata, - frame->frame.len - G_STRUCT_OFFSET (SysprofCaptureMetadata, metadata)); + frame->frame.len - offsetof (SysprofCaptureMetadata, metadata)); break; } diff --git a/src/libsysprof-capture/sysprof-capture-writer.c b/src/libsysprof-capture/sysprof-capture-writer.c index 1e27729f..953328e8 100644 --- a/src/libsysprof-capture/sysprof-capture-writer.c +++ b/src/libsysprof-capture/sysprof-capture-writer.c @@ -904,7 +904,7 @@ again: ret = _sysprof_pwrite (self->fd, &end_time, sizeof (end_time), - G_STRUCT_OFFSET (SysprofCaptureFileHeader, end_time)); + offsetof (SysprofCaptureFileHeader, end_time)); if (ret < 0 && errno == EAGAIN) goto again; @@ -1341,7 +1341,7 @@ do_start: ret = _sysprof_pwrite (self->fd, &start_time, sizeof (start_time), - G_STRUCT_OFFSET (SysprofCaptureFileHeader, time)); + offsetof (SysprofCaptureFileHeader, time)); if (ret < 0 && errno == EAGAIN) goto do_start; @@ -1350,7 +1350,7 @@ do_end: ret = _sysprof_pwrite (self->fd, &end_time, sizeof (end_time), - G_STRUCT_OFFSET (SysprofCaptureFileHeader, end_time)); + offsetof (SysprofCaptureFileHeader, end_time)); if (ret < 0 && errno == EAGAIN) goto do_end;