[binutils-gdb] gdb: do minor code modernization in make_pointer_type and make_reference_type
Tankut Baris Aktemur via Gdb-cvs <[email protected]> Mon, 3 Aug 2026 15:32:52 +0000 (GMT)
| Newsgroups | gmane.comp.gdb.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D23ee11771f16= 449e384ada7a0de83722aaceafcf commit 23ee11771f16449e384ada7a0de83722aaceafcf Author: Tankut Baris Aktemur <[email protected]> Date: Mon Aug 3 15:52:35 2026 +0200 gdb: do minor code modernization in make_pointer_type and make_referenc= e_type =20 This is a small code modernization. There should be no behavioral change. =20 Approved-By: Simon Marchi <[email protected]> Diff: --- gdb/gdbtypes.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 2dda175237c..409601abe03 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -366,10 +366,8 @@ smash_type (struct type *type) type * make_pointer_type (type *type) { - struct type *ntype; /* New type */ - ntype =3D type->pointer_type; - - if (ntype) + struct type *ntype =3D type->pointer_type; + if (ntype !=3D nullptr) return ntype; =20 ntype =3D type_allocator (type).new_type (); @@ -403,23 +401,22 @@ lookup_pointer_type (struct type *type) type * make_reference_type (type *type, type_code refcode) { - struct type *ntype; /* New type */ - struct type **reftype; - gdb_assert (refcode =3D=3D TYPE_CODE_REF || refcode =3D=3D TYPE_CODE_RVA= LUE_REF); =20 - ntype =3D (refcode =3D=3D TYPE_CODE_REF ? type->reference_type - : type->rvalue_reference_type); + struct type *ntype =3D (refcode =3D=3D TYPE_CODE_REF + ? type->reference_type + : type->rvalue_reference_type); =20 - if (ntype) + if (ntype !=3D nullptr) return ntype; =20 ntype =3D type_allocator (type).new_type (); ntype->set_target_type (type); - reftype =3D (refcode =3D=3D TYPE_CODE_REF ? &type->reference_type - : &type->rvalue_reference_type); =20 - *reftype =3D ntype; + if (refcode =3D=3D TYPE_CODE_REF) + type->reference_type =3D ntype; + else + type->rvalue_reference_type =3D ntype; =20 /* FIXME! Assume the machine has only one representation for references, and that it matches the (only) representation for