libsysprof-capture: Drop GError usage from SysprofCaptureReader

Use `errno` instead, which is icky, but given that all of the failure
modes are from POSIX I/O functions, it’s at least in keeping with them.

This is a major API break.

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

Helps: #40
This commit is contained in:
Philip Withnall
2020-07-02 12:56:12 +01:00
parent fde278fb7f
commit e19d70bca0
19 changed files with 114 additions and 131 deletions

View File

@ -59,9 +59,9 @@ main (gint argc,
}
if (g_strcmp0 ("-", argv[1]) == 0)
reader = sysprof_capture_reader_new_from_fd (dup (STDIN_FILENO), 0);
reader = sysprof_capture_reader_new_from_fd (dup (STDIN_FILENO));
else
reader = sysprof_capture_reader_new (argv[1], 0);
reader = sysprof_capture_reader_new (argv[1]);
if (reader == NULL)
{

View File

@ -73,10 +73,11 @@ main (gint argc,
g_autoptr(SysprofCaptureReader) reader = NULL;
g_autoptr(GError) error = NULL;
if (!(reader = sysprof_capture_reader_new (argv[i], &error)))
if (!(reader = sysprof_capture_reader_new (argv[i])))
{
int errsv = errno;
g_printerr ("Failed to create reader for \"%s\": %s\n",
argv[i], error->message);
argv[i], g_strerror (errsv));
return EXIT_FAILURE;
}

View File

@ -136,10 +136,11 @@ merge_files (gint argc,
g_autoptr(SysprofCaptureReader) reader = NULL;
g_autoptr(GError) error = NULL;
if (!(reader = sysprof_capture_reader_new (argv[i], &error)))
if (!(reader = sysprof_capture_reader_new (argv[i])))
{
int errsv = errno;
g_printerr ("Failed to create reader for \"%s\": %s\n",
argv[i], error->message);
argv[i], g_strerror (errsv));
return EXIT_FAILURE;
}

View File

@ -56,9 +56,10 @@ main (gint argc,
return EXIT_FAILURE;
}
if ((reader = sysprof_capture_reader_new (argv[1], &error)) == NULL)
if ((reader = sysprof_capture_reader_new (argv[1])) == NULL)
{
g_printerr ("%s\n", error->message);
int errsv = errno;
g_printerr ("%s\n", g_strerror (errsv));
return EXIT_FAILURE;
}