mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
libsysprof-capture: Add SysprofCaptureJitmapIter to replace GHashTable
Change `sysprof_capture_reader_read_jitmap()` to return a `const SysprofCaptureJitmap *` (like the other `read` functions), and add a new `SysprofCaptureJitmapIter` type to allow easy iteration over the jitmap. This allows a use of `GHashTable` to be removed from the API. It breaks the libsysprof-capture API and ABI. All the callers iterate over the jitmap rather than looking up elements by key. If that functionality is needed in future, additional API can be added to allow it on `SysprofCaptureJitmap`. Signed-off-by: Philip Withnall <withnall@endlessm.com> Helps: #40
This commit is contained in:
@ -115,18 +115,18 @@ main (gint argc,
|
||||
|
||||
case SYSPROF_CAPTURE_FRAME_JITMAP:
|
||||
{
|
||||
g_autoptr(GHashTable) ret = sysprof_capture_reader_read_jitmap (reader);
|
||||
GHashTableIter iter;
|
||||
const SysprofCaptureJitmap *jitmap = sysprof_capture_reader_read_jitmap (reader);
|
||||
SysprofCaptureJitmapIter iter;
|
||||
SysprofCaptureAddress addr;
|
||||
const gchar *str;
|
||||
|
||||
if (ret == NULL)
|
||||
if (jitmap == NULL)
|
||||
return EXIT_FAILURE;
|
||||
|
||||
g_print ("JITMAP:\n");
|
||||
|
||||
g_hash_table_iter_init (&iter, ret);
|
||||
while (g_hash_table_iter_next (&iter, (gpointer *)&addr, (gpointer *)&str))
|
||||
sysprof_capture_jitmap_iter_init (&iter, jitmap);
|
||||
while (sysprof_capture_jitmap_iter_next (&iter, &addr, &str))
|
||||
g_print (" " SYSPROF_CAPTURE_ADDRESS_FORMAT " : %s\n", addr, str);
|
||||
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user