From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15688 invoked by alias); 21 Jul 2011 11:08:22 -0000 Received: (qmail 15677 invoked by uid 22791); 21 Jul 2011 11:08:21 -0000 X-SWARE-Spam-Status: No, hits=-6.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 21 Jul 2011 11:07:55 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p6LB7sOw007253 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 21 Jul 2011 07:07:55 -0400 Received: from localhost.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p6LB7rNA023512; Thu, 21 Jul 2011 07:07:54 -0400 From: Phil Muldoon To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [patch] [python] Prompt substitution References: Reply-to: pmuldoon@redhat.com X-URL: http://www.redhat.com Date: Thu, 21 Jul 2011 11:15:00 -0000 In-Reply-To: (Tom Tromey's message of "Wed, 20 Jul 2011 08:31:57 -0600") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-IsSubscribed: yes 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 X-SW-Source: 2011-07/txt/msg00577.txt.bz2 Tom Tromey writes: >>>>>> "Phil" == Phil Muldoon writes: > > Phil> Current patch attached. > > Code bits are ok. > > Remember to send an updated ChangeLog when you update a patch. Thanks, and so committed. One note: as this patch and the upcoming prompt memory cleanups patch alter set_prompt in similar ways, I changed this patch to match Pedro's xstrdup request. I've included the hunk below. I also forgot to write a NEWS entry. I will send a patch for that soon. Cheers, Phil =================================================================== RCS file: /cvs/src/src/gdb/top.c,v retrieving revision 1.199 retrieving revision 1.200 diff -u -r1.199 -r1.200 --- src/gdb/top.c 2011/06/27 19:21:50 1.199 +++ src/gdb/top.c 2011/07/21 11:03:45 1.200 @@ -1133,14 +1133,17 @@ } void -set_prompt (char *s) +set_prompt (const char *s) { -/* ??rehrauer: I don't know why this fails, since it looks as though - assignments to prompt are wrapped in calls to xstrdup... - if (prompt != NULL) - xfree (prompt); - */ - PROMPT (0) = xstrdup (s); + char *p = xstrdup (s); + + xfree (PROMPT (0)); + PROMPT (0) = p; + + /* Also, free and set new_async_prompt so prompt changes sync up + with set/show prompt. */ + xfree (new_async_prompt); + new_async_prompt = xstrdup (PROMPT (0)); }