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.
This commit is contained in:
Lubomir Rintel
2023-04-11 13:49:03 +00:00
committed by Aleksander Morgado
parent e1e7bc8de6
commit c40876de95
14 changed files with 26 additions and 33 deletions
+1 -1
View File
@@ -80,7 +80,7 @@ sqport_ready (MMPortSerialAt *port,
GTask *task)
{
MMPortProbe *probe;
const gchar *response;
g_autofree gchar *response = NULL;
probe = g_task_get_source_object (task);
+1 -1
View File
@@ -158,7 +158,7 @@ response_ready (MMPortSerialAt *port,
{
CustomInitContext *ctx;
MMPortProbe *probe;
const gchar *response;
g_autofree gchar *response = NULL;
GError *error = NULL;
gchar *lower;
DellManufacturer manufacturer;
+1 -1
View File
@@ -104,7 +104,7 @@ getportmode_ready (MMPortSerialAt *port,
MMDevice *device;
MMPortProbe *probe;
HuaweiCustomInitContext *ctx;
const gchar *response;
g_autofree gchar *response = NULL;
GArray *modes;
g_autoptr(GError) error = NULL;
+1 -1
View File
@@ -61,7 +61,7 @@ gmr_ready (MMPortSerialAt *port,
{
MMPortProbe *probe;
const gchar *p;
const gchar *response;
g_autofree gchar *response = NULL;
probe = g_task_get_source_object (task);
+2 -1
View File
@@ -49,10 +49,11 @@ nwdmat_ready (MMPortSerialAt *port,
{
g_autoptr(GError) error = NULL;
MMPortProbe *probe;
g_autofree gchar *response = NULL;
probe = g_task_get_source_object (task);
mm_port_serial_at_command_finish (port, res, &error);
response = mm_port_serial_at_command_finish (port, res, &error);
if (error) {
if (g_error_matches (error, MM_SERIAL_ERROR, MM_SERIAL_ERROR_RESPONSE_TIMEOUT)) {
custom_init_step (task);
+1 -1
View File
@@ -105,7 +105,7 @@ gcap_ready (MMPortSerialAt *port,
{
MMPortProbe *probe;
SierraCustomInitContext *ctx;
const gchar *response;
g_autofree gchar *response = NULL;
GError *error = NULL;
probe = g_task_get_source_object (task);
+1 -1
View File
@@ -185,7 +185,7 @@ getportcfg_ready (MMPortSerialAt *port,
GAsyncResult *res,
GTask *task)
{
const gchar *response;
g_autofree gchar *response = NULL;
GError *error = NULL;
MMPortProbe *probe;
TelitCustomInitContext *ctx;
+2 -1
View File
@@ -151,10 +151,11 @@ quick_at_ready (MMPortSerialAt *port,
{
MMPortProbe *probe;
g_autoptr(GError) error = NULL;
g_autofree gchar *response = NULL;
probe = g_task_get_source_object (task);
mm_port_serial_at_command_finish (port, res, &error);
response = mm_port_serial_at_command_finish (port, res, &error);
if (error) {
/* On a timeout error, wait for READY URC */
if (g_error_matches (error, MM_SERIAL_ERROR, MM_SERIAL_ERROR_RESPONSE_TIMEOUT)) {
+4 -4
View File
@@ -63,10 +63,10 @@ gmr_ready (MMPortSerialAt *port,
GAsyncResult *res,
GTask *task)
{
MMPortProbe *probe;
const gchar *p;
const gchar *response;
GError *error = NULL;
MMPortProbe *probe;
const gchar *p;
g_autofree gchar *response = NULL;
GError *error = NULL;
probe = g_task_get_source_object (task);