aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tools
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2022-01-06 12:50:33 -0800
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2022-01-06 12:58:39 -0800
commitcfab569484b18407fc117bb96634525cc76ea1f5 (patch)
tree754ec37148cc95958f1657e25768ad69565ebf23 /tools
parent9f09e69ecb077082301dafb745856e1f3731aaa7 (diff)
build: Replace use of g_memdup with util_memdup
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.
Diffstat (limited to 'tools')
-rw-r--r--tools/gatt-service.c15
-rw-r--r--tools/mesh-gatt/gatt.c5
2 files changed, 11 insertions, 9 deletions
diff --git a/tools/gatt-service.c b/tools/gatt-service.c
index 631c4f249e..ed6b06f1e7 100644
--- a/tools/gatt-service.c
+++ b/tools/gatt-service.c
@@ -26,6 +26,7 @@
#include "gdbus/gdbus.h"
#include "src/error.h"
+#include "src/shared/util.h"
#define GATT_MGR_IFACE "org.bluez.GattManager1"
#define GATT_SERVICE_IFACE "org.bluez.GattService1"
@@ -126,8 +127,8 @@ static gboolean desc_get_value(const GDBusPropertyTable *property,
static void desc_write(struct descriptor *desc, const uint8_t *value, int len)
{
- g_free(desc->value);
- desc->value = g_memdup(value, len);
+ free(desc->value);
+ desc->value = util_memdup(value, len);
desc->vlen = len;
g_dbus_emit_property_changed(connection, desc->path,
@@ -264,8 +265,8 @@ static gboolean chr_get_props(const GDBusPropertyTable *property,
static void chr_write(struct characteristic *chr, const uint8_t *value, int len)
{
- g_free(chr->value);
- chr->value = g_memdup(value, len);
+ free(chr->value);
+ chr->value = util_memdup(value, len);
chr->vlen = len;
g_dbus_emit_property_changed(connection, chr->path, GATT_CHR_IFACE,
@@ -388,7 +389,7 @@ static void chr_iface_destroy(gpointer user_data)
g_free(chr->uuid);
g_free(chr->service);
- g_free(chr->value);
+ free(chr->value);
g_free(chr->path);
g_free(chr);
}
@@ -398,7 +399,7 @@ static void desc_iface_destroy(gpointer user_data)
struct descriptor *desc = user_data;
g_free(desc->uuid);
- g_free(desc->value);
+ free(desc->value);
g_free(desc->path);
g_free(desc);
}
@@ -592,7 +593,7 @@ static gboolean register_characteristic(const char *chr_uuid,
chr = g_new0(struct characteristic, 1);
chr->uuid = g_strdup(chr_uuid);
- chr->value = g_memdup(value, vlen);
+ chr->value = util_memdup(value, vlen);
chr->vlen = vlen;
chr->props = props;
chr->service = g_strdup(service_path);
diff --git a/tools/mesh-gatt/gatt.c b/tools/mesh-gatt/gatt.c
index c8a8123fbd..ab9743cd10 100644
--- a/tools/mesh-gatt/gatt.c
+++ b/tools/mesh-gatt/gatt.c
@@ -24,6 +24,7 @@
#include "src/shared/io.h"
#include "src/shared/shell.h"
+#include "src/shared/util.h"
#include "gdbus/gdbus.h"
#include "lib/bluetooth.h"
#include "lib/uuid.h"
@@ -86,7 +87,7 @@ static void write_data_free(void *user_data)
{
struct write_data *data = user_data;
- g_free(data->gatt_data);
+ free(data->gatt_data);
free(data);
}
@@ -338,7 +339,7 @@ bool mesh_gatt_write(GDBusProxy *proxy, uint8_t *buf, uint16_t len,
/* TODO: should keep in queue in case we need to cancel write? */
data->gatt_len = len;
- data->gatt_data = g_memdup(buf, len);
+ data->gatt_data = util_memdup(buf, len);
data->gatt_data[0] &= GATT_TYPE_MASK;
data->iov.iov_base = data->gatt_data;
data->iov.iov_len = len;