From patchwork Tue Nov 26 21:29:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Simon Marchi (Code Review)" X-Patchwork-Id: 36268 Received: (qmail 11927 invoked by alias); 26 Nov 2019 21:29:14 -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 11854 invoked by uid 89); 26 Nov 2019 21:29:13 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy= X-HELO: mx1.osci.io Received: from polly.osci.io (HELO mx1.osci.io) (8.43.85.229) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 26 Nov 2019 21:29:12 +0000 Received: by mx1.osci.io (Postfix, from userid 994) id 9D572202D0; Tue, 26 Nov 2019 16:29:10 -0500 (EST) Received: from gnutoolchain-gerrit.osci.io (gnutoolchain-gerrit.osci.io [IPv6:2620:52:3:1:5054:ff:fe06:16ca]) by mx1.osci.io (Postfix) with ESMTP id C6828203A5; Tue, 26 Nov 2019 16:29:07 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by gnutoolchain-gerrit.osci.io (Postfix) with ESMTP id A8E3928173; Tue, 26 Nov 2019 16:29:07 -0500 (EST) X-Gerrit-PatchSet: 3 Date: Tue, 26 Nov 2019 16:29:07 -0500 From: "Sourceware to Gerrit sync (Code Review)" To: Tom Tromey , gdb-patches@sourceware.org Cc: Andrew Burgess Auto-Submitted: auto-generated X-Gerrit-MessageType: merged Subject: [pushed] Use cmd_list_element::doc_allocated for Python commands X-Gerrit-Change-Id: I0014edc117b051bba1f4db267687d231e7fe9b56 X-Gerrit-Change-Number: 661 X-Gerrit-ChangeURL: X-Gerrit-Commit: 8318f3c337cf46ee6309b4a7f06f3934fc94b4bd In-Reply-To: References: Reply-To: noreply@gnutoolchain-gerrit.osci.io, tromey@sourceware.org, andrew.burgess@embecosm.com, gdb-patches@sourceware.org MIME-Version: 1.0 Content-Disposition: inline User-Agent: Gerrit/3.0.3-79-g83ff7f88f1 Message-Id: <20191126212907.A8E3928173@gnutoolchain-gerrit.osci.io> Sourceware to Gerrit sync has submitted this change. Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/661 ...................................................................... Use cmd_list_element::doc_allocated for Python commands Python commands manage their "doc" string manually, but cmd_list_element already has doc_allocated to handle this case. This changes the Python code to use the existing facility. gdb/ChangeLog 2019-11-26 Tom Tromey * python/py-cmd.c (cmdpy_destroyer): Don't free "doc". (cmdpy_init): Set "doc_allocated". Change-Id: I0014edc117b051bba1f4db267687d231e7fe9b56 --- M gdb/ChangeLog M gdb/python/py-cmd.c 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 94a8bdc..821afd3 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2019-11-26 Tom Tromey + * python/py-cmd.c (cmdpy_destroyer): Don't free "doc". + (cmdpy_init): Set "doc_allocated". + +2019-11-26 Tom Tromey + * gdbsupport/thread-pool.c (thread_pool::set_thread_count): Set name of worker thread. * gdbsupport/common.m4 (GDB_AC_COMMON): Check for diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c index 87d1888..e3497d6 100644 --- a/gdb/python/py-cmd.c +++ b/gdb/python/py-cmd.c @@ -98,10 +98,8 @@ gdbpy_ref cmd ((cmdpy_object *) context); cmd->command = NULL; - /* We allocated the name, doc string, and perhaps the prefix - name. */ + /* We allocated the name and perhaps the prefix name. */ xfree ((char *) self->name); - xfree ((char *) self->doc); xfree ((char *) self->prefixname); } @@ -563,6 +561,7 @@ /* There appears to be no API to set this. */ cmd->func = cmdpy_function; cmd->destroyer = cmdpy_destroyer; + cmd->doc_allocated = 1; obj->command = cmd; set_cmd_context (cmd, self_ref.release ());