type_smob *t_smob
= tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct type *type = t_smob->type;
+ const char *tagname = nullptr;
- if (!TYPE_TAG_NAME (type))
+ if (TYPE_CODE (type) == TYPE_CODE_STRUCT
+ || TYPE_CODE (type) == TYPE_CODE_UNION
+ || TYPE_CODE (type) == TYPE_CODE_ENUM)
+ tagname = TYPE_NAME (type);
+
+ if (tagname == nullptr)
return SCM_BOOL_F;
- return gdbscm_scm_from_c_string (TYPE_TAG_NAME (type));
+ return gdbscm_scm_from_c_string (tagname);
}
/* (type-name <gdb:type>) -> string
struct type *type = t_smob->type;
char *field;
int i;
- struct cleanup *cleanups;
SCM_ASSERT_TYPE (scm_is_string (field_scm), field_scm, SCM_ARG2, FUNC_NAME,
_("string"));
_(not_composite_error));
field = gdbscm_scm_to_c_string (field_scm);
- cleanups = make_cleanup (xfree, field);
for (i = 0; i < TYPE_NFIELDS (type); i++)
{
if (t_field_name && (strcmp_iw (t_field_name, field) == 0))
{
- do_cleanups (cleanups);
- return tyscm_make_field_smob (self, i);
+ xfree (field);
+ return tyscm_make_field_smob (self, i);
}
}
- do_cleanups (cleanups);
+ xfree (field);
gdbscm_out_of_range_error (FUNC_NAME, SCM_ARG1, field_scm,
_("Unknown field"));
struct type *type = t_smob->type;
char *field;
int i;
- struct cleanup *cleanups;
SCM_ASSERT_TYPE (scm_is_string (field_scm), field_scm, SCM_ARG2, FUNC_NAME,
_("string"));
_(not_composite_error));
field = gdbscm_scm_to_c_string (field_scm);
- cleanups = make_cleanup (xfree, field);
for (i = 0; i < TYPE_NFIELDS (type); i++)
{
if (t_field_name && (strcmp_iw (t_field_name, field) == 0))
{
- do_cleanups (cleanups);
- return SCM_BOOL_T;
+ xfree (field);
+ return SCM_BOOL_T;
}
}
- do_cleanups (cleanups);
+ xfree (field);
return SCM_BOOL_F;
}