diff options
| author | Simon Marchi <simon.marchi@polymtl.ca> | 2026-02-08 17:04:10 -0500 |
|---|---|---|
| committer | Simon Marchi <simon.marchi@efficios.com> | 2026-02-09 12:48:35 -0500 |
| commit | ea71a4081d98075998e297a6d95683f837889720 (patch) | |
| tree | fa98ef7050cafe579610940d7ec9febf671dc73f /gdb/python | |
| parent | efc9a57e40624d209867620779453759fe619f20 (diff) | |
| download | binutils-ea71a4081d98075998e297a6d95683f837889720.tar.gz binutils-ea71a4081d98075998e297a6d95683f837889720.tar.bz2 binutils-ea71a4081d98075998e297a6d95683f837889720.zip | |
gdb/registry: make registry::key::emplace return a reference
Since we use C++ and not C, I think that we should gradually move to
using references for things that can never be nullptr. One example of
this is the return value of the emplace method.
Change it to return a reference, and (to keep the patch straightforward)
update all callers to take the address. More patches could follow to
propagate the use of references further.
Change-Id: I725539694cf496f8288918cc29d7aaae9aca2292
Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb/python')
| -rw-r--r-- | gdb/python/py-registers.c | 2 | ||||
| -rw-r--r-- | gdb/python/py-unwind.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/gdb/python/py-registers.c b/gdb/python/py-registers.c index 0ec708364dd..b345229ea61 100644 --- a/gdb/python/py-registers.c +++ b/gdb/python/py-registers.c @@ -143,7 +143,7 @@ gdbpy_get_register_descriptor (struct gdbarch *gdbarch, { gdbpy_register_type *vecp = gdbpy_register_object_data.get (gdbarch); if (vecp == nullptr) - vecp = gdbpy_register_object_data.emplace (gdbarch); + vecp = &gdbpy_register_object_data.emplace (gdbarch); gdbpy_register_type &vec = *vecp; /* Ensure that we have enough entries in the vector. */ diff --git a/gdb/python/py-unwind.c b/gdb/python/py-unwind.c index 7c0779a8270..c2579f3c35a 100644 --- a/gdb/python/py-unwind.c +++ b/gdb/python/py-unwind.c @@ -996,7 +996,7 @@ pyuw_on_new_gdbarch (gdbarch *newarch) { struct pyuw_gdbarch_data_type *data = pyuw_gdbarch_data.get (newarch); if (data == nullptr) - data= pyuw_gdbarch_data.emplace (newarch); + data = &pyuw_gdbarch_data.emplace (newarch); if (!data->unwinder_registered) { |
