Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [RFA 13/13] Remove make_cleanup_py_decref and make_cleanup_py_xdecref
Date: Sun, 20 Nov 2016 20:42:00 -0000	[thread overview]
Message-ID: <1479674496-14000-14-git-send-email-tom@tromey.com> (raw)
In-Reply-To: <1479674496-14000-1-git-send-email-tom@tromey.com>

make_cleanup_py_decref and make_cleanup_py_xdecref are now unused, so
this patch removes themm.  Future Python changes should use gdbpy_ref
instead.

2016-11-20  Tom Tromey  <tom@tromey.com>

	* python/python-internal.h (make_cleanup_py_decref)
	(make_cleanup_py_xdecref): Don't declare.
	* python/py-utils.c (py_decref, make_cleanup_py_decref)
	(py_xdecref, make_cleanup_py_xdecref): Remove.
---
 gdb/ChangeLog                |  7 +++++++
 gdb/python/py-utils.c        | 42 ------------------------------------------
 gdb/python/python-internal.h |  3 ---
 3 files changed, 7 insertions(+), 45 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b974442..c6edec2 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,12 @@
 2016-11-20  Tom Tromey  <tom@tromey.com>
 
+	* python/python-internal.h (make_cleanup_py_decref)
+	(make_cleanup_py_xdecref): Don't declare.
+	* python/py-utils.c (py_decref, make_cleanup_py_decref)
+	(py_xdecref, make_cleanup_py_xdecref): Remove.
+
+2016-11-20  Tom Tromey  <tom@tromey.com>
+
 	* python/py-framefilter.c (py_mi_print_variables): Use gdbpy_ref.
 	(py_print_locals, enumerate_locals, py_print_args): Use gdbpy_ref.
 
diff --git a/gdb/python/py-utils.c b/gdb/python/py-utils.c
index 6b7540c..7ca8b39 100644
--- a/gdb/python/py-utils.c
+++ b/gdb/python/py-utils.c
@@ -23,48 +23,6 @@
 #include "python-internal.h"
 #include "py-ref.h"
 
-/* This is a cleanup function which decrements the refcount on a
-   Python object.  */
-
-static void
-py_decref (void *p)
-{
-  PyObject *py = (PyObject *) p;
-
-  Py_DECREF (py);
-}
-
-/* Return a new cleanup which will decrement the Python object's
-   refcount when run.  */
-
-struct cleanup *
-make_cleanup_py_decref (PyObject *py)
-{
-  return make_cleanup (py_decref, (void *) py);
-}
-
-/* This is a cleanup function which decrements the refcount on a
-   Python object.  This function accounts appropriately for NULL
-   references.  */
-
-static void
-py_xdecref (void *p)
-{
-  PyObject *py = (PyObject *) p;
-
-  Py_XDECREF (py);
-}
-
-/* Return a new cleanup which will decrement the Python object's
-   refcount when run.  Account for and operate on NULL references
-   correctly.  */
-
-struct cleanup *
-make_cleanup_py_xdecref (PyObject *py)
-{
-  return make_cleanup (py_xdecref, py);
-}
-
 /* Converts a Python 8-bit string to a unicode string object.  Assumes the
    8-bit string is in the host charset.  If an error occurs during conversion,
    returns NULL with a python exception set.
diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h
index e63ceed..4ff6ac2 100644
--- a/gdb/python/python-internal.h
+++ b/gdb/python/python-internal.h
@@ -498,9 +498,6 @@ int gdbpy_initialize_xmethods (void)
 int gdbpy_initialize_unwind (void)
   CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
 
-struct cleanup *make_cleanup_py_decref (PyObject *py);
-struct cleanup *make_cleanup_py_xdecref (PyObject *py);
-
 /* Called before entering the Python interpreter to install the
    current language and architecture to be used for Python values.
    Also set the active extension language for GDB so that SIGINT's
-- 
2.7.4


  parent reply	other threads:[~2016-11-20 20:42 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-20 20:42 [RFA 00/13] series #4 of c++ in python Tom Tromey
2016-11-20 20:41 ` [RFA 06/13] Use gdbpy_ref in py-inferior.c Tom Tromey
2016-11-20 20:41 ` [RFA 01/13] Use gdbpy_ref in archpy_disassemble Tom Tromey
2016-11-20 20:41 ` [RFA 02/13] Use gdbpy_ref in gdbpy_breakpoint_cond_says_stop Tom Tromey
2016-11-20 20:41 ` [RFA 05/13] Use gdbpy_ref in py_print_frame Tom Tromey
2016-11-20 20:42 ` [RFA 10/13] Use gdbpy_ref in py-utils.c Tom Tromey
2016-11-20 20:42 ` Tom Tromey [this message]
2016-11-22 17:27   ` [RFA 13/13] Remove make_cleanup_py_decref and make_cleanup_py_xdecref Pedro Alves
2016-11-20 20:42 ` [RFA 03/13] Use gdbpy_ref in py-cmd.c Tom Tromey
2016-11-21 22:46   ` Tom Tromey
2016-11-20 20:42 ` [RFA 12/13] Use gdbpy_ref rather than make_cleanup_py_decref Tom Tromey
2016-11-20 20:42 ` [RFA 09/13] Use gdbpy_ref in pyuw_object_attribute_to_pointer Tom Tromey
2016-11-20 20:42 ` [RFA 07/13] Use gdbpy_ref in py-param.c Tom Tromey
2016-11-20 20:42 ` [RFA 08/13] Use gdbpy_ref in python.c Tom Tromey
2016-11-22 17:21   ` Pedro Alves
2016-11-28 23:08     ` Tom Tromey
2016-11-20 20:42 ` [RFA 04/13] Use gdbpy_ref in bpfinishpy_out_of_scope Tom Tromey
2016-11-20 20:48 ` [RFA 11/13] Use gdbpy_ref in enumerate_args Tom Tromey
2016-11-21 22:44 ` [RFA 00/13] series #4 of c++ in python Tom Tromey
2016-11-22 17:28 ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1479674496-14000-14-git-send-email-tom@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox