From patchwork Sun Nov 20 20:41:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 17656 Received: (qmail 12423 invoked by alias); 20 Nov 2016 20:42:31 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 12167 invoked by uid 89); 20 Nov 2016 20:42:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=no version=3.3.2 spammy=decrement, H*RU:10.0.90.82, Hx-spam-relays-external:69.89.25.95, UD:py-utils.c X-HELO: gproxy1.mail.unifiedlayer.com Received: from gproxy1-pub.mail.unifiedlayer.com (HELO gproxy1.mail.unifiedlayer.com) (69.89.25.95) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 20 Nov 2016 20:42:15 +0000 Received: from CMOut01 (cmgw2 [10.0.90.82]) by gproxy1.mail.unifiedlayer.com (Postfix) with ESMTP id BA1C2176963 for ; Sun, 20 Nov 2016 13:41:48 -0700 (MST) Received: from box522.bluehost.com ([74.220.219.122]) by CMOut01 with id ALhk1u0012f2jeq01LhnNP; Sun, 20 Nov 2016 13:41:47 -0700 X-Authority-Analysis: v=2.1 cv=QtDNgzCd c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=L24OOQBejmoA:10 a=zstS-IiYAAAA:8 a=051DjxoXBviomSG1nwgA:9 a=4G6NA9xxw8l3yy4pmD5M:22 Received: from 174-16-143-211.hlrn.qwest.net ([174.16.143.211]:40590 helo=bapiya.Home) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.86_1) (envelope-from ) id 1c8Yvp-0005f5-8V; Sun, 20 Nov 2016 13:41:45 -0700 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 13/13] Remove make_cleanup_py_decref and make_cleanup_py_xdecref Date: Sun, 20 Nov 2016 13:41:36 -0700 Message-Id: <1479674496-14000-14-git-send-email-tom@tromey.com> In-Reply-To: <1479674496-14000-1-git-send-email-tom@tromey.com> References: <1479674496-14000-1-git-send-email-tom@tromey.com> X-BWhitelist: no X-Exim-ID: 1c8Yvp-0005f5-8V X-Source-Sender: 174-16-143-211.hlrn.qwest.net (bapiya.Home) [174.16.143.211]:40590 X-Source-Auth: tom+tromey.com X-Email-Count: 15 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== 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 * 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 + * 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 + * 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