diff options
author | Tom Tromey <tom@tromey.com> | 2019-11-15 16:49:17 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2019-11-26 14:20:29 -0700 |
commit | 1a6d41c6433a0980f302c480b1d1db71234b49e4 (patch) | |
tree | d751d01c179f3b3d40ca503d3a73a11056177536 /gdb/python | |
parent | 8318f3c337cf46ee6309b4a7f06f3934fc94b4bd (diff) | |
download | gdb-1a6d41c6433a0980f302c480b1d1db71234b49e4.zip gdb-1a6d41c6433a0980f302c480b1d1db71234b49e4.tar.gz gdb-1a6d41c6433a0980f302c480b1d1db71234b49e4.tar.bz2 |
Add add_internal_function overload
add_internal_function sets a command destroyer that frees the doc
string. However, many callers do not pass in an allocated doc string.
This adds a new overload to clearly differentiate the two cases,
fixing the latent bug.
gdb/ChangeLog
2019-11-26 Tom Tromey <tom@tromey.com>
* value.h (add_internal_function): Add new overload. Move
documentation from value.h.
* value.c (do_add_internal_function): New function.
(add_internal_function): Use it. Add new overload.
(function_destroyer): Don't free doc.
* python/py-function.c (fnpy_init): Update.
Change-Id: I3f6df925bc6b3e1bccbad9eeebc487b908bb5a2a
Diffstat (limited to 'gdb/python')
-rw-r--r-- | gdb/python/py-function.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gdb/python/py-function.c b/gdb/python/py-function.c index 46a66cf..1c45887 100644 --- a/gdb/python/py-function.c +++ b/gdb/python/py-function.c @@ -127,7 +127,7 @@ fnpy_init (PyObject *self, PyObject *args, PyObject *kwds) if (! docstring) docstring.reset (xstrdup (_("This function is not documented."))); - add_internal_function (name, docstring.release (), fnpy_call, + add_internal_function (name, std::move (docstring), fnpy_call, self_ref.release ()); return 0; } |