diff mbox series

[03/22] sim: Remove g_strfreev use

Message ID 20240226033724.1460079-3-denkenz@gmail.com (mailing list archive)
State Superseded, archived
Headers show
Series [01/22] gprs: Remove g_strfreev and g_strdupv use | expand

Commit Message

Denis Kenzior Feb. 26, 2024, 3:36 a.m. UTC
Replace by l_strfreev
---
 src/sim.c | 37 +++++++++++++++++--------------------
 1 file changed, 17 insertions(+), 20 deletions(-)
diff mbox series

Patch

diff --git a/src/sim.c b/src/sim.c
index 1873eccccf2e..db65d22f40fd 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -264,13 +264,13 @@  static char **get_own_numbers(GSList *own_numbers)
 	if (own_numbers)
 		nelem = g_slist_length(own_numbers);
 
-	ret = g_new0(char *, nelem + 1);
+	ret = l_new(char *, nelem + 1);
 
 	nelem = 0;
 	for (l = own_numbers; l; l = l->next) {
 		num = l->data;
 
-		ret[nelem++] = g_strdup(phone_number_to_string(num));
+		ret[nelem++] = l_strdup(phone_number_to_string(num));
 	}
 
 	return ret;
@@ -289,7 +289,7 @@  static char **get_locked_pins(struct ofono_sim *sim)
 		nelem += 1;
 	}
 
-	ret = g_new0(char *, nelem + 1);
+	ret = l_new(char *, nelem + 1);
 
 	nelem = 0;
 
@@ -297,7 +297,7 @@  static char **get_locked_pins(struct ofono_sim *sim)
 		if (sim->locked_pins[i] == FALSE)
 			continue;
 
-		ret[nelem] = g_strdup(sim_passwd_name(i));
+		ret[nelem] = l_strdup(sim_passwd_name(i));
 		nelem += 1;
 	}
 
@@ -345,14 +345,14 @@  static char **get_service_numbers(GSList *service_numbers)
 
 	nelem = g_slist_length(service_numbers) * 2;
 
-	ret = g_new0(char *, nelem + 1);
+	ret = l_new(char *, nelem + 1);
 
 	nelem = 0;
 	for (l = service_numbers; l; l = l->next) {
 		num = l->data;
 
-		ret[nelem++] = g_strdup(num->id);
-		ret[nelem++] = g_strdup(phone_number_to_string(&num->ph));
+		ret[nelem++] = l_strdup(num->id);
+		ret[nelem++] = l_strdup(phone_number_to_string(&num->ph));
 	}
 
 	return ret;
@@ -444,15 +444,14 @@  static DBusMessage *sim_get_properties(DBusConnection *conn,
 	}
 
 	own_numbers = get_own_numbers(sim->own_numbers);
-
 	ofono_dbus_dict_append_array(&dict, "SubscriberNumbers",
 					DBUS_TYPE_STRING, &own_numbers);
-	g_strfreev(own_numbers);
+	l_strfreev(own_numbers);
 
 	locked_pins = get_locked_pins(sim);
 	ofono_dbus_dict_append_array(&dict, "LockedPins",
 					DBUS_TYPE_STRING, &locked_pins);
-	g_strfreev(locked_pins);
+	l_strfreev(locked_pins);
 
 	if (sim->service_numbers && sim->sdn_ready) {
 		service_numbers = get_service_numbers(sim->service_numbers);
@@ -460,7 +459,7 @@  static DBusMessage *sim_get_properties(DBusConnection *conn,
 		ofono_dbus_dict_append_dict(&dict, "ServiceNumbers",
 						DBUS_TYPE_STRING,
 						&service_numbers);
-		g_strfreev(service_numbers);
+		l_strfreev(service_numbers);
 	}
 
 	if (sim->language_prefs)
@@ -832,7 +831,7 @@  static void sim_locked_cb(struct ofono_sim *sim, gboolean locked)
 	if (g_strcmp0(typestr, "pin") == 0)
 		pin_cache_update(sim->iccid, pin);
 
-	g_strfreev(locked_pins);
+	l_strfreev(locked_pins);
 
 	sim_pin_retries_check(sim);
 }
@@ -1413,13 +1412,11 @@  check:
 		sim->own_numbers = sim->new_numbers;
 
 		own_numbers = get_own_numbers(sim->own_numbers);
-
 		ofono_dbus_signal_array_property_changed(conn, path,
 						OFONO_SIM_MANAGER_INTERFACE,
 						"SubscriberNumbers",
 						DBUS_TYPE_STRING, &own_numbers);
-
-		g_strfreev(own_numbers);
+		l_strfreev(own_numbers);
 	} else {
 		g_slist_free_full(sim->new_numbers, g_free);
 	}
@@ -1504,7 +1501,7 @@  check:
 						"ServiceNumbers",
 						DBUS_TYPE_STRING,
 						&service_numbers);
-		g_strfreev(service_numbers);
+		l_strfreev(service_numbers);
 	}
 }
 
@@ -2328,7 +2325,7 @@  static void sim_efli_efpl_changed(int id, void *userdata)
 		return;
 
 	if (sim->language_prefs) {
-		g_strfreev(sim->language_prefs);
+		l_strfreev(sim->language_prefs);
 		sim->language_prefs = NULL;
 	}
 
@@ -2604,7 +2601,7 @@  static void sim_free_early_state(struct ofono_sim *sim)
 	}
 
 	if (sim->language_prefs) {
-		g_strfreev(sim->language_prefs);
+		l_strfreev(sim->language_prefs);
 		sim->language_prefs = NULL;
 	}
 
@@ -2764,7 +2761,7 @@  static void sim_set_locked_pin(struct ofono_sim *sim,
 				OFONO_SIM_MANAGER_INTERFACE, "LockedPins",
 				DBUS_TYPE_STRING, &locked_pins);
 
-	g_strfreev(locked_pins);
+	l_strfreev(locked_pins);
 }
 
 static void sim_query_fac_pinlock_cb(const struct ofono_error *error,
@@ -3187,7 +3184,7 @@  static void sim_pin_query_cb(const struct ofono_error *error,
 						"LockedPins", DBUS_TYPE_STRING,
 						&locked_pins);
 
-				g_strfreev(locked_pins);
+				l_strfreev(locked_pins);
 			}
 		}