From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 42341 invoked by alias); 24 Sep 2017 02:46:22 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 42056 invoked by uid 89); 24 Sep 2017 02:46:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.0 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: gproxy5-pub.mail.unifiedlayer.com Received: from gproxy5-pub.mail.unifiedlayer.com (HELO gproxy5-pub.mail.unifiedlayer.com) (67.222.38.55) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 24 Sep 2017 02:46:16 +0000 Received: from cmgw3 (unknown [10.0.90.84]) by gproxy5.mail.unifiedlayer.com (Postfix) with ESMTP id 36EE714044D for ; Sat, 23 Sep 2017 20:46:15 -0600 (MDT) Received: from box522.bluehost.com ([74.220.219.122]) by cmgw3 with id DEmC1w00E2f2jeq01EmFuP; Sat, 23 Sep 2017 20:46:15 -0600 X-Authority-Analysis: v=2.2 cv=K/VSJ2eI c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=2JCJgTwv5E4A:10 a=zstS-IiYAAAA:8 a=QAOmer3h9DjUGMOtaf0A:9 a=4G6NA9xxw8l3yy4pmD5M:22 Received: from 75-166-76-94.hlrn.qwest.net ([75.166.76.94]:56144 helo=bapiya.Home) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1dvwvs-001i9G-3L; Sat, 23 Sep 2017 20:46:12 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 5/5] Remove the last cleanup from regcache.c Date: Sun, 24 Sep 2017 02:46:00 -0000 Message-Id: <20170924024608.4346-6-tom@tromey.com> In-Reply-To: <20170924024608.4346-1-tom@tromey.com> References: <20170924024608.4346-1-tom@tromey.com> X-BWhitelist: no X-Exim-ID: 1dvwvs-001i9G-3L X-Source-Sender: 75-166-76-94.hlrn.qwest.net (bapiya.Home) [75.166.76.94]:56144 X-Source-Auth: tom+tromey.com X-Email-Count: 7 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== X-Local-Domain: yes X-SW-Source: 2017-09/txt/msg00739.txt.bz2 This removes the last cleanup from regcache.c by changing one function to use std::string. ChangeLog 2017-09-23 Tom Tromey * regcache.c (regcache::dump): Use string_printf. --- gdb/ChangeLog | 4 ++++ gdb/regcache.c | 11 ++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/gdb/regcache.c b/gdb/regcache.c index 46d8cfb..0eefec6 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -1350,7 +1350,6 @@ reg_flush_command (char *command, int from_tty) void regcache::dump (ui_file *file, enum regcache_dump_what what_to_dump) { - struct cleanup *cleanups = make_cleanup (null_cleanup, NULL); struct gdbarch *gdbarch = m_descr->gdbarch; int regnum; int footnote_nr = 0; @@ -1442,6 +1441,7 @@ regcache::dump (ui_file *file, enum regcache_dump_what what_to_dump) /* Type. */ { const char *t; + std::string name_holder; if (regnum < 0) t = "Type"; @@ -1452,13 +1452,11 @@ regcache::dump (ui_file *file, enum regcache_dump_what what_to_dump) t = TYPE_NAME (register_type (arch (), regnum)); if (t == NULL) { - char *n; - if (!footnote_register_type_name_null) footnote_register_type_name_null = ++footnote_nr; - n = xstrprintf ("*%d", footnote_register_type_name_null); - make_cleanup (xfree, n); - t = n; + name_holder = string_printf ("*%d", + footnote_register_type_name_null); + t = name_holder.c_str (); } /* Chop a leading builtin_type. */ if (startswith (t, blt)) @@ -1592,7 +1590,6 @@ regcache::dump (ui_file *file, enum regcache_dump_what what_to_dump) fprintf_unfiltered (file, "*%d: Register type's name NULL.\n", footnote_register_type_name_null); - do_cleanups (cleanups); } static void -- 2.9.5