aboutsummaryrefslogtreecommitdiff
path: root/gdb/namespace.h
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2024-06-12 18:58:49 +0200
committerTom de Vries <tdevries@suse.de>2024-06-12 18:58:49 +0200
commit764af878259768bb70c65bdf3f3285c2d6409bbd (patch)
treebf3bc2a132a945048a154717a02f7f1f9b19048d /gdb/namespace.h
parent72476aca8f585a026a54cf71ccdf7bed26db1903 (diff)
downloadgdb-764af878259768bb70c65bdf3f3285c2d6409bbd.zip
gdb-764af878259768bb70c65bdf3f3285c2d6409bbd.tar.gz
gdb-764af878259768bb70c65bdf3f3285c2d6409bbd.tar.bz2
[gdb/python] Add typesafe wrapper around PyObject_CallMethod
In gdb/python/py-tui.c we have code like this: ... gdbpy_ref<> result (PyObject_CallMethod (m_window.get(), "hscroll", "i", num_to_scroll, nullptr)); ... The nullptr is superfluous, the format string already indicates that there's only one method argument. OTOH, passing no method args does use a nullptr: ... gdbpy_ref<> result (PyObject_CallMethod (m_window.get (), "render", nullptr)); ... Furthermore, choosing the right format string chars can be tricky. Add a typesafe wrapper around PyObject_CallMethod that hides these details, such that we can use the more intuitive: ... gdbpy_ref<> result (gdbpy_call_method (m_window.get(), "hscroll", num_to_scroll)); ... and: ... gdbpy_ref<> result (gdbpy_call_method (m_window.get (), "render")); ... Tested on x86_64-linux. Co-Authored-By: Tom de Vries <tdevries@suse.de> Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb/namespace.h')
0 files changed, 0 insertions, 0 deletions