From 868d9e36daa62233e2a00daf366b49733e39f050 Mon Sep 17 00:00:00 2001 From: Evangelos Ribeiro Tzaras Date: Mon, 12 Apr 2021 11:33:57 +0200 Subject: [PATCH] codestyle: get rid of CALLS_SET_PTR_PROPERTY macro One more step towards fixing #214 In `calls-ofono-call.c` the changed code also adheres to the newly introduced coding style. --- plugins/ofono/calls-ofono-call.c | 10 ++++------ src/calls-call-record.c | 4 ++-- src/util.h | 5 ----- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/plugins/ofono/calls-ofono-call.c b/plugins/ofono/calls-ofono-call.c index 784cf74..c6a3552 100644 --- a/plugins/ofono/calls-ofono-call.c +++ b/plugins/ofono/calls-ofono-call.c @@ -25,7 +25,6 @@ #include "calls-ofono-call.h" #include "calls-call.h" #include "calls-message-source.h" -#include "util.h" #include @@ -287,11 +286,10 @@ static void disconnect_reason_cb (CallsOfonoCall *self, const gchar *reason) { - if (reason) - { - CALLS_SET_PTR_PROPERTY (self->disconnect_reason, - g_strdup (reason)); - } + if (reason) { + g_free (self->disconnect_reason); + self->disconnect_reason = g_strdup (reason); + } } diff --git a/src/calls-call-record.c b/src/calls-call-record.c index 43f30c7..5ec92b5 100644 --- a/src/calls-call-record.c +++ b/src/calls-call-record.c @@ -23,7 +23,6 @@ */ #include "calls-call-record.h" -#include "util.h" #include @@ -132,7 +131,8 @@ set_property (GObject *object, break; case PROP_TARGET: - CALLS_SET_PTR_PROPERTY (self->target, g_value_dup_string (value)); + g_free (self->target); + self->target = g_value_dup_string (value); break; case PROP_INBOUND: diff --git a/src/util.h b/src/util.h index 1615035..b01d910 100644 --- a/src/util.h +++ b/src/util.h @@ -88,11 +88,6 @@ G_BEGIN_DECLS CALLS_DEFINE_IFACE_GETTER_BASE(calls,iface,Calls,Iface,CALLS,IFACE,prop,rettype,errval) -#define CALLS_SET_PTR_PROPERTY(ptr,new_value) \ - g_free (ptr); \ - ptr = new_value; - - #define calls_clear_source(source_id_ptr) \ if (*source_id_ptr != 0) \ { \