From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10449 invoked by alias); 18 Jul 2012 14:59:43 -0000 Received: (qmail 10439 invoked by uid 22791); 18 Jul 2012 14:59:42 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=AWL,BAYES_00,DATE_IN_FUTURE_03_06,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 18 Jul 2012 14:59:28 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1SrVip-00037i-EB from Yao_Qi@mentor.com ; Wed, 18 Jul 2012 07:59:27 -0700 Received: from SVR-ORW-FEM-05.mgc.mentorg.com ([147.34.97.43]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Wed, 18 Jul 2012 07:59:27 -0700 Received: from qiyao.dyndns.org (147.34.91.1) by svr-orw-fem-05.mgc.mentorg.com (147.34.97.43) with Microsoft SMTP Server id 14.1.289.1; Wed, 18 Jul 2012 07:59:25 -0700 From: Yao Qi To: CC: Jan Kratochvil Subject: Re: [obv] Handle var_string_noescape and var_optional_filename together. Date: Wed, 18 Jul 2012 14:59:00 -0000 Message-ID: <2030807.PK0sv4maNt@qiyao.dyndns.org> User-Agent: KMail/4.8.3 (Linux/3.3.7-1.fc16.i686; KDE/4.8.3; i686; ; ) In-Reply-To: <20120718135655.GB10378@host2.jankratochvil.net> References: <1342636814-1674-1-git-send-email-yao@codesourcery.com> <20120718135655.GB10378@host2.jankratochvil.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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: 2012-07/txt/msg00264.txt.bz2 On Wednesday, July 18, 2012 03:56:55 PM Jan Kratochvil wrote: > On Wed, 18 Jul 2012 20:40:14 +0200, Yao Qi wrote: > > I notice that the code in case var_string_noescape and > > var_optional_filename are exactly the same, so this patch is to combine > > them together. I'll commit it in two days. >=20 > I do not agree, this will hide an existing bug. >=20 Oh, I didn't realize that there may be a bug when handling var_optional_fil= ename here. > Correct it to fix var_optional_filename to be more like var_filename > (clearing whitespaces + doing tilde_expand); except sure without that: > if (arg =3D=3D NULL) > error_no_arg (_("filename to set it to.")); How about this one? --=20 Yao (=E9=BD=90=E5=B0=A7) gdb: 2012-07-18 Yao Qi * cli/cli-setshow.c (do_setshow_command): Handle case 'var_filename' and case 'var_optional_filename' together. --- gdb/cli/cli-setshow.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c index 521ac0e..e44a35e 100644 --- a/gdb/cli/cli-setshow.c +++ b/gdb/cli/cli-setshow.c @@ -183,15 +183,15 @@ do_setshow_command (char *arg, int from_tty, struct c= md_list_element *c) *(char **) c->var =3D xstrdup (arg); break; case var_optional_filename: - if (arg =3D=3D NULL) - arg =3D ""; - if (*(char **) c->var !=3D NULL) - xfree (*(char **) c->var); - *(char **) c->var =3D xstrdup (arg); - break; case var_filename: if (arg =3D=3D NULL) - error_no_arg (_("filename to set it to.")); + { + if (c->var_type =3D=3D var_filename) + error_no_arg (_("filename to set it to.")); + else + arg =3D ""; + } + if (*(char **) c->var !=3D NULL) xfree (*(char **) c->var); { --=20 1.7.7.6