summaryrefslogtreecommitdiff
path: root/plugins/itanium
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2021-03-07 17:52:38 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2021-03-07 17:52:38 (GMT)
commit7a60504691ebd8b914592e60990cc3526cf26e29 (patch)
tree8093ae850e6dc720296c71deee3c3eb0a5763ed1 /plugins/itanium
parenta79d209385fca4e74a6a85b2386be71ec23057bb (diff)
Compact data type definitions.
Diffstat (limited to 'plugins/itanium')
-rw-r--r--plugins/itanium/abi.c20
-rw-r--r--plugins/itanium/component.c5
2 files changed, 22 insertions, 3 deletions
diff --git a/plugins/itanium/abi.c b/plugins/itanium/abi.c
index 213d5f7..393a8d6 100644
--- a/plugins/itanium/abi.c
+++ b/plugins/itanium/abi.c
@@ -2194,6 +2194,7 @@ static itanium_component *itd_builtin_type(GItaniumDemangling *context)
GDataType *std; /* Espace de noms */
itanium_component *vendor; /* Extension propriétaire */
GDataType *builtin; /* Type construit */
+ bool status; /* Bilan de rattachement */
/**
* La règle traitée ici est la suivante :
@@ -2351,7 +2352,16 @@ static itanium_component *itd_builtin_type(GItaniumDemangling *context)
std = g_class_enum_type_new(CEK_NAMESPACE, strdup("std"));
builtin = g_class_enum_type_new(CEK_CLASS, strdup("nullptr_t"));
- g_data_type_set_namespace(builtin, std, strdup("::"));
+ status = g_data_type_set_namespace(builtin, std, "::");
+
+ g_object_unref(G_OBJECT(std));
+
+ if (!status)
+ {
+ g_object_unref(G_OBJECT(builtin));
+ result = NULL;
+ goto done;
+ }
result = itd_make_type(builtin);
itd_set_type(result, ICT_STD_SUBST);
@@ -3438,6 +3448,7 @@ static itanium_component *itd_substitution(GItaniumDemangling *context)
const itanium_std_subst_info *stdinfo; /* Raccourci de confort */
GDataType *std; /* Espace de noms */
GDataType *type; /* Type complet final */
+ bool status; /* Bilan de rattachement */
/**
* La règle traitée ici est la suivante :
@@ -3488,7 +3499,12 @@ static itanium_component *itd_substitution(GItaniumDemangling *context)
else
{
type = g_class_enum_type_new(CEK_CLASS, strdup(stdinfo->class));
- g_data_type_set_namespace(type, std, strdup("::"));
+ status = g_data_type_set_namespace(type, std, "::");
+ g_object_unref(G_OBJECT(std));
+
+ if (!status)
+ break;
+
}
result = itd_make_type(type);
diff --git a/plugins/itanium/component.c b/plugins/itanium/component.c
index 558936a..b2f004b 100644
--- a/plugins/itanium/component.c
+++ b/plugins/itanium/component.c
@@ -1370,7 +1370,10 @@ static void itd_prepend_namespace_to_type(GDataType *type, GDataType *ns)
existing = g_data_type_get_namespace(type);
if (existing == NULL)
- g_data_type_set_namespace(type, ns, strdup("::"));
+ {
+ g_data_type_set_namespace(type, ns, "::");
+ g_object_unref(G_OBJECT(ns));
+ }
else
{