From cfab569484b18407fc117bb96634525cc76ea1f5 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Thu, 6 Jan 2022 12:50:33 -0800 Subject: build: Replace use of g_memdup with util_memdup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This replaces the uses of g_memdup with util_memdup since the former has been deprecated: warning: ‘g_memdup’ is deprecated: Use 'g_memdup2' instead [-Wdeprecated-declarations] g_memdup2 requires bumping glib version which would likely have its own problems thus why util_memdup was introduced. --- plugins/neard.c | 9 +++++---- plugins/policy.c | 7 ++++--- 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'plugins') diff --git a/plugins/neard.c b/plugins/neard.c index e07b51106..a75527148 100644 --- a/plugins/neard.c +++ b/plugins/neard.c @@ -30,6 +30,7 @@ #include "src/eir.h" #include "src/agent.h" #include "src/btd.h" +#include "src/shared/util.h" #define NEARD_NAME "org.neard" #define NEARD_PATH "/" @@ -71,7 +72,7 @@ static void free_oob_params(struct oob_params *params) g_free(params->name); g_free(params->hash); g_free(params->randomizer); - g_free(params->pin); + free(params->pin); } static DBusMessage *error_reply(DBusMessage *msg, int error) @@ -407,10 +408,10 @@ static int process_nokia_long (void *data, size_t size, uint8_t marker, remote->name = g_strndup((char *)n->name, n->name_len); if (marker == 0x01) { - remote->pin = g_memdup(n->authentication, 4); + remote->pin = util_memdup(n->authentication, 4); remote->pin_len = 4; } else if (marker == 0x02) { - remote->pin = g_memdup(n->authentication, 16); + remote->pin = util_memdup(n->authentication, 16); remote->pin_len = 16; } @@ -439,7 +440,7 @@ static int process_nokia_short (void *data, size_t size, if (n->name_len > 0) remote->name = g_strndup((char *)n->name, n->name_len); - remote->pin = g_memdup(n->authentication, 4); + remote->pin = util_memdup(n->authentication, 4); remote->pin_len = 4; return 0; diff --git a/plugins/policy.c b/plugins/policy.c index 051db82e1..48f5db7d3 100644 --- a/plugins/policy.c +++ b/plugins/policy.c @@ -32,6 +32,7 @@ #include "src/profile.h" #include "src/btd.h" #include "src/shared/timeout.h" +#include "src/shared/util.h" #define CONTROL_CONNECT_TIMEOUT 2 #define SOURCE_RETRY_TIMEOUT 2 @@ -855,7 +856,7 @@ static int policy_init(void) reconnect_attempts = default_attempts; reconnect_intervals_len = sizeof(default_intervals) / sizeof(*reconnect_intervals); - reconnect_intervals = g_memdup(default_intervals, + reconnect_intervals = util_memdup(default_intervals, sizeof(default_intervals)); goto done; } @@ -886,7 +887,7 @@ static int policy_init(void) g_clear_error(&gerr); reconnect_intervals_len = sizeof(default_intervals) / sizeof(*reconnect_intervals); - reconnect_intervals = g_memdup(default_intervals, + reconnect_intervals = util_memdup(default_intervals, sizeof(default_intervals)); } @@ -919,7 +920,7 @@ static void policy_exit(void) if (reconnect_uuids) g_strfreev(reconnect_uuids); - g_free(reconnect_intervals); + free(reconnect_intervals); g_slist_free_full(reconnects, reconnect_destroy); -- cgit v1.2.1