libsysprof-capture: Rewrite list_files() to avoid GHashTable/GPtrArray

This changes its API and ABI: it now returns an allocated array of const
strings, rather than an allocated array of allocated strings.

The call sites in the source tree have been adjusted accordingly.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #40
This commit is contained in:
Philip Withnall
2020-07-02 12:38:32 +01:00
parent 13b1e79901
commit 75b69d0a89
4 changed files with 71 additions and 19 deletions

View File

@ -64,9 +64,9 @@ main (gint argc,
if (list_files)
{
g_auto(GStrv) files = sysprof_capture_reader_list_files (reader);
g_autofree const gchar **files = sysprof_capture_reader_list_files (reader);
for (guint i = 0; files[i]; i++)
for (gsize i = 0; files[i]; i++)
g_print ("%s\n", files[i]);
return EXIT_SUCCESS;