diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2023-01-08 19:57:31 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2023-04-11 13:49:03 +0000 |
commit | c40876de956311ef9a17b920486263d46f4fef3b (patch) | |
tree | 381c755c74cc53fc99e0f8c53ea260f4da3a5da0 /src/mm-base-modem-at.c | |
parent | e1e7bc8de6c6d90e79444fc2f0b0cf912c9d791c (diff) |
port-serial-at: make mm_port_serial_at_command_finish() transfer ownership
This will make it slightly easier to port mm_port_serial_at_command() to
use GTask, since we won't have to keep a pointer to the result in GTask
after _finish() has been called.
In most cases the caller needs the value anyway, so this doesn't add too
much hasle.
Diffstat (limited to 'src/mm-base-modem-at.c')
-rw-r--r-- | src/mm-base-modem-at.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/mm-base-modem-at.c b/src/mm-base-modem-at.c index d1352e08..893a3280 100644 --- a/src/mm-base-modem-at.c +++ b/src/mm-base-modem-at.c @@ -160,7 +160,7 @@ at_sequence_parse_response (MMPortSerialAt *port, GVariant *result = NULL; GError *result_error = NULL; GSimpleAsyncResult *simple; - const gchar *response; + g_autofree gchar *response = NULL; GError *error = NULL; response = mm_port_serial_at_command_finish (port, res, &error); @@ -513,7 +513,7 @@ at_command_ready (MMPortSerialAt *port, GAsyncResult *res, AtCommandContext *ctx) { - const gchar *response; + gchar *response; GError *error = NULL; response = mm_port_serial_at_command_finish (port, res, &error); @@ -530,7 +530,7 @@ at_command_ready (MMPortSerialAt *port, g_simple_async_result_take_error (ctx->result, error); /* Valid string response */ else if (response) - g_simple_async_result_set_op_res_gpointer (ctx->result, (gchar *)response, NULL); + g_simple_async_result_set_op_res_gpointer (ctx->result, response, g_free); else g_assert_not_reached (); |