From b8e8fe3a9906b2ea79dcfd95c1daace9e3984a91 Mon Sep 17 00:00:00 2001 From: Wootak Jung Date: Tue, 14 Dec 2021 08:41:21 +0900 Subject: [PATCH] Replace g_memdup to g_memdup2 Change-Id: I1bf121d5610cbf9047379398b550e9cefdb92f07 --- src/core_object/co_network.c | 2 +- src/core_object/co_phonebook.c | 4 ++-- src/core_object/co_sim.c | 34 +++++++++++++++++----------------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/core_object/co_network.c b/src/core_object/co_network.c index ee71088..5d4f355 100644 --- a/src/core_object/co_network.c +++ b/src/core_object/co_network.c @@ -1136,7 +1136,7 @@ TReturn tcore_network_operator_info_add(CoreObject *co, g_hash_table_insert(po->operator_info_hash, g_strdup(plmn), - g_memdup(noi, sizeof(struct tcore_network_operator_info))); + g_memdup2(noi, sizeof(struct tcore_network_operator_info))); return TCORE_RETURN_SUCCESS; } diff --git a/src/core_object/co_phonebook.c b/src/core_object/co_phonebook.c index 0c53b77..1bb84b8 100644 --- a/src/core_object/co_phonebook.c +++ b/src/core_object/co_phonebook.c @@ -153,7 +153,7 @@ struct tel_phonebook_support_list *tcore_phonebook_get_support_list(CoreObject * return NULL; } - return g_memdup(&po->support_list, sizeof(struct tel_phonebook_support_list)); + return g_memdup2(&po->support_list, sizeof(struct tel_phonebook_support_list)); } gboolean tcore_phonebook_set_support_list(CoreObject *o, struct tel_phonebook_support_list *list) @@ -183,7 +183,7 @@ struct tel_phonebook_field_support_list *tcore_phonebook_get_field_support_list( return NULL; } - return g_memdup(&po->field_support_list, sizeof(struct tel_phonebook_field_support_list)); + return g_memdup2(&po->field_support_list, sizeof(struct tel_phonebook_field_support_list)); } gboolean tcore_phonebook_set_field_support_list(CoreObject *o, struct tel_phonebook_field_support_list *list) diff --git a/src/core_object/co_sim.c b/src/core_object/co_sim.c index 23283e4..69166f6 100644 --- a/src/core_object/co_sim.c +++ b/src/core_object/co_sim.c @@ -3664,7 +3664,7 @@ struct tel_sim_imsi *tcore_sim_get_imsi(CoreObject *o) return NULL; } - return g_memdup(&po->imsi, sizeof(struct tel_sim_imsi)); + return g_memdup2(&po->imsi, sizeof(struct tel_sim_imsi)); } gboolean tcore_sim_set_imsi(CoreObject *o, const struct tel_sim_imsi *imsi) @@ -3723,7 +3723,7 @@ struct tel_sim_msisdn_list* tcore_sim_get_msisdn_list(CoreObject *o) return NULL; } - return g_memdup(po->msisdn_list, sizeof(struct tel_sim_msisdn_list)); + return g_memdup2(po->msisdn_list, sizeof(struct tel_sim_msisdn_list)); } gboolean tcore_sim_set_msisdn_list(CoreObject *o, const struct tel_sim_msisdn_list *msisdn_list) @@ -3743,7 +3743,7 @@ gboolean tcore_sim_set_msisdn_list(CoreObject *o, const struct tel_sim_msisdn_li memset(po->msisdn_list, 0x0, sizeof(struct tel_sim_msisdn_list)); } else { if (msisdn_list) - po->msisdn_list = g_memdup(msisdn_list, sizeof(struct tel_sim_msisdn_list)); + po->msisdn_list = g_memdup2(msisdn_list, sizeof(struct tel_sim_msisdn_list)); else po->msisdn_list = g_malloc0(sizeof(struct tel_sim_msisdn_list)); } @@ -3782,7 +3782,7 @@ struct tel_sim_service_table *tcore_sim_get_service_table(CoreObject *o) return NULL; } - return g_memdup(po->svct, sizeof(struct tel_sim_service_table)); + return g_memdup2(po->svct, sizeof(struct tel_sim_service_table)); } gboolean tcore_sim_set_service_table(CoreObject *o, const struct tel_sim_service_table *svct) @@ -3802,7 +3802,7 @@ gboolean tcore_sim_set_service_table(CoreObject *o, const struct tel_sim_service memset(po->svct, 0x0, sizeof(struct tel_sim_service_table)); } else { if (svct) - po->svct = g_memdup(svct, sizeof(struct tel_sim_service_table)); + po->svct = g_memdup2(svct, sizeof(struct tel_sim_service_table)); else po->svct = g_malloc0(sizeof(struct tel_sim_service_table)); } @@ -3869,7 +3869,7 @@ struct tel_sim_cphs_csp *tcore_sim_get_csp(CoreObject *o) return NULL; } - return g_memdup(po->csp, sizeof(struct tel_sim_cphs_csp)); + return g_memdup2(po->csp, sizeof(struct tel_sim_cphs_csp)); } gboolean tcore_sim_set_csp(CoreObject *o, const struct tel_sim_cphs_csp *csp) @@ -3889,7 +3889,7 @@ gboolean tcore_sim_set_csp(CoreObject *o, const struct tel_sim_cphs_csp *csp) memset(po->csp, 0x0, sizeof(struct tel_sim_cphs_csp)); } else { if (csp) - po->csp = g_memdup(csp, sizeof(struct tel_sim_cphs_csp)); + po->csp = g_memdup2(csp, sizeof(struct tel_sim_cphs_csp)); else po->csp = g_malloc0(sizeof(struct tel_sim_cphs_csp)); } @@ -3928,7 +3928,7 @@ struct tel_sim_ecc_list *tcore_sim_get_ecc_list(CoreObject *o) return NULL; } - return g_memdup(po->ecc_list, sizeof(struct tel_sim_ecc_list)); + return g_memdup2(po->ecc_list, sizeof(struct tel_sim_ecc_list)); } gboolean tcore_sim_set_ecc_list(CoreObject *o, const struct tel_sim_ecc_list *ecc_list) @@ -3948,7 +3948,7 @@ gboolean tcore_sim_set_ecc_list(CoreObject *o, const struct tel_sim_ecc_list *ec memset(po->ecc_list, 0x0, sizeof(struct tel_sim_ecc_list)); } else { if (ecc_list) - po->ecc_list = g_memdup(ecc_list, sizeof(struct tel_sim_ecc_list)); + po->ecc_list = g_memdup2(ecc_list, sizeof(struct tel_sim_ecc_list)); else po->ecc_list = g_malloc0(sizeof(struct tel_sim_ecc_list)); } @@ -3987,7 +3987,7 @@ struct tel_sim_spn *tcore_sim_get_spn(CoreObject *o) return NULL; } - return g_memdup(po->spn, sizeof(struct tel_sim_spn)); + return g_memdup2(po->spn, sizeof(struct tel_sim_spn)); } gboolean tcore_sim_set_spn(CoreObject *o, const struct tel_sim_spn *spn) @@ -4007,7 +4007,7 @@ gboolean tcore_sim_set_spn(CoreObject *o, const struct tel_sim_spn *spn) memset(po->spn, 0x0, sizeof(struct tel_sim_spn)); } else { if (spn) - po->spn = g_memdup(spn, sizeof(struct tel_sim_spn)); + po->spn = g_memdup2(spn, sizeof(struct tel_sim_spn)); else po->spn = g_malloc0(sizeof(struct tel_sim_spn)); } @@ -4046,7 +4046,7 @@ struct tel_sim_cphs_netname *tcore_sim_get_cphs_netname(CoreObject *o) return NULL; } - return g_memdup(po->cphs_netname, sizeof(struct tel_sim_cphs_netname)); + return g_memdup2(po->cphs_netname, sizeof(struct tel_sim_cphs_netname)); } gboolean tcore_sim_set_cphs_netname(CoreObject *o, const struct tel_sim_cphs_netname *cphs_netname) @@ -4066,7 +4066,7 @@ gboolean tcore_sim_set_cphs_netname(CoreObject *o, const struct tel_sim_cphs_net memset(po->cphs_netname, 0x0, sizeof(struct tel_sim_cphs_netname)); } else { if (cphs_netname) - po->cphs_netname = g_memdup(cphs_netname, sizeof(struct tel_sim_cphs_netname)); + po->cphs_netname = g_memdup2(cphs_netname, sizeof(struct tel_sim_cphs_netname)); else po->cphs_netname = g_malloc0(sizeof(struct tel_sim_cphs_netname)); } @@ -4105,7 +4105,7 @@ struct tel_sim_iccid *tcore_sim_get_iccid(CoreObject *o) return NULL; } - return g_memdup(po->iccid, sizeof(struct tel_sim_iccid)); + return g_memdup2(po->iccid, sizeof(struct tel_sim_iccid)); } gboolean tcore_sim_set_iccid(CoreObject *o, const struct tel_sim_iccid *iccid) @@ -4125,7 +4125,7 @@ gboolean tcore_sim_set_iccid(CoreObject *o, const struct tel_sim_iccid *iccid) memset(po->iccid, 0x0, sizeof(struct tel_sim_iccid)); } else { if (iccid) - po->iccid = g_memdup(iccid, sizeof(struct tel_sim_iccid)); + po->iccid = g_memdup2(iccid, sizeof(struct tel_sim_iccid)); else po->iccid = g_malloc0(sizeof(struct tel_sim_iccid)); } @@ -4241,7 +4241,7 @@ struct tel_sim_ist *tcore_sim_get_isim_service_table(CoreObject *o) return NULL; } - return g_memdup(po->ist, sizeof(struct tel_sim_ist)); + return g_memdup2(po->ist, sizeof(struct tel_sim_ist)); } gboolean tcore_sim_set_isim_service_table(CoreObject *o, const struct tel_sim_ist *ist) @@ -4262,7 +4262,7 @@ gboolean tcore_sim_set_isim_service_table(CoreObject *o, const struct tel_sim_is if (po->ist) memcpy(po->ist, ist, sizeof(struct tel_sim_ist)); else - po->ist = g_memdup(ist, sizeof(struct tel_sim_ist)); + po->ist = g_memdup2(ist, sizeof(struct tel_sim_ist)); return TRUE; } -- 2.7.4