[sysprof] libsysprof-capture: add sysprof_capture_reader_find_file()
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sysprof] libsysprof-capture: add sysprof_capture_reader_find_file()
- Date: Wed, 29 May 2019 22:50:47 +0000 (UTC)
commit 7743a047b6cfcdbf1f2fe45987f9672da4eb2c2c
Author: Christian Hergert <chergert redhat com>
Date: Tue May 28 22:46:50 2019 -0700
libsysprof-capture: add sysprof_capture_reader_find_file()
src/libsysprof-capture/sysprof-capture-reader.c | 31 +++++++++++++++++++++++++
src/libsysprof-capture/sysprof-capture-reader.h | 3 +++
2 files changed, 34 insertions(+)
---
diff --git a/src/libsysprof-capture/sysprof-capture-reader.c b/src/libsysprof-capture/sysprof-capture-reader.c
index 567db71..1a1fa7a 100644
--- a/src/libsysprof-capture/sysprof-capture-reader.c
+++ b/src/libsysprof-capture/sysprof-capture-reader.c
@@ -1285,3 +1285,34 @@ sysprof_capture_reader_get_byte_order (SysprofCaptureReader *self)
return self->endian;
}
+
+const SysprofCaptureFileChunk *
+sysprof_capture_reader_find_file (SysprofCaptureReader *self,
+ const gchar *path)
+{
+ SysprofCaptureFrameType type;
+
+ g_return_val_if_fail (self != NULL, NULL);
+ g_return_val_if_fail (path != NULL, NULL);
+
+ while (sysprof_capture_reader_peek_type (self, &type))
+ {
+ if (type == SYSPROF_CAPTURE_FRAME_FILE_CHUNK)
+ {
+ const SysprofCaptureFileChunk *fc;
+
+ if (!(fc = sysprof_capture_reader_read_file (self)))
+ break;
+
+ if (g_strcmp0 (path, fc->path) == 0)
+ return fc;
+
+ continue;
+ }
+
+ if (!sysprof_capture_reader_skip (self))
+ break;
+ }
+
+ return NULL;
+}
diff --git a/src/libsysprof-capture/sysprof-capture-reader.h b/src/libsysprof-capture/sysprof-capture-reader.h
index 49b3071..c963b6f 100644
--- a/src/libsysprof-capture/sysprof-capture-reader.h
+++ b/src/libsysprof-capture/sysprof-capture-reader.h
@@ -100,6 +100,9 @@ SYSPROF_AVAILABLE_IN_ALL
void sysprof_capture_reader_set_stat (SysprofCaptureReader
*self,
const SysprofCaptureStat
*st_buf);
SYSPROF_AVAILABLE_IN_ALL
+const SysprofCaptureFileChunk *sysprof_capture_reader_find_file (SysprofCaptureReader
*self,
+ const gchar
*path);
+SYSPROF_AVAILABLE_IN_ALL
gchar **sysprof_capture_reader_list_files (SysprofCaptureReader
*self);
SYSPROF_AVAILABLE_IN_ALL
gboolean sysprof_capture_reader_read_file_fd (SysprofCaptureReader
*self,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]