From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23697 invoked by alias); 27 Aug 2012 22:14:20 -0000 Received: (qmail 23689 invoked by uid 22791); 27 Aug 2012 22:14:19 -0000 X-SWARE-Spam-Status: No, hits=-5.3 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail-ee0-f73.google.com (HELO mail-ee0-f73.google.com) (74.125.83.73) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 27 Aug 2012 22:14:05 +0000 Received: by eeke49 with SMTP id e49so214710eek.0 for ; Mon, 27 Aug 2012 15:14:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:content-type:content-transfer-encoding:message-id:date :to:cc:subject:in-reply-to:references:x-mailer:from :x-gm-message-state; bh=T1BS/yifsV4eDRlm1IvHU55au63ZG9trOuFLEqbY/i0=; b=frFScGa+Mlyk4YwFbujgeZBTmFLkf+dlov0fPYHQ9CqaifiaLjliYZssD8jV95tT9O foulTP4BVcinMLQSUekAXlXbMPU3u1hWePQWp27sUXCyMf50slv09kdEdBZA8I3+PIDR GRJWdaDpFdB4Ppgj979fgSB2Ej3ZtaIvC1lLQWyhqmheyX5zJAimbZJK8nOwgHMv+FHV PqcbupM/WMAXjPvkYr62Tv8IXuCkG/wx40HHxMSe6xzKJkV4qACnV80Tps6NlNKhx770 nFN9c4Gp0oMqHYWx09hLX682iY+iPNULMb9HEYO9g+yg1ePxz6vD4laRpRwqYoBpjl/P JNVQ== Received: by 10.180.107.167 with SMTP id hd7mr2014142wib.0.1346105644667; Mon, 27 Aug 2012 15:14:04 -0700 (PDT) Received: by 10.180.107.167 with SMTP id hd7mr2014139wib.0.1346105644624; Mon, 27 Aug 2012 15:14:04 -0700 (PDT) Received: from hpza10.eem.corp.google.com ([74.125.121.33]) by gmr-mx.google.com with ESMTPS id fa8si177301wid.1.2012.08.27.15.14.04 (version=TLSv1/SSLv3 cipher=AES128-SHA); Mon, 27 Aug 2012 15:14:04 -0700 (PDT) Received: from ruffy2.mtv.corp.google.com (ruffy2.mtv.corp.google.com [172.18.110.129]) by hpza10.eem.corp.google.com (Postfix) with ESMTP id 62CE0200057; Mon, 27 Aug 2012 15:14:03 -0700 (PDT) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <20539.61738.119545.634687@ruffy2.mtv.corp.google.com> Date: Mon, 27 Aug 2012 22:14:00 -0000 To: Yao Qi Cc: Subject: Re: [PATCH 1/3] var_integer -> var_uinteger In-Reply-To: <503B476F.50805@codesourcery.com> References: <7A6A55B4-0293-4AD6-AB1F-B3169F8ADCC1@cs.umd.edu> <1344871663-915-1-git-send-email-yao@codesourcery.com> <1344871663-915-2-git-send-email-yao@codesourcery.com> <20534.29766.629459.204573@ruffy2.mtv.corp.google.com> <50372591.7080404@codesourcery.com> <20535.46196.619465.922388@ruffy2.mtv.corp.google.com> <503B476F.50805@codesourcery.com> From: dje@google.com X-Gm-Message-State: ALoCoQk4x8MCUknL0rR8IbJ9YQTf7vFKOJqTnJfF/y4I81Gnr9HXNgJCwPwlkyQs5KTG1LQUKHbIKsBZgPOzXILuMXvUhF4Wy9g0kaVnB7zE3zgh8XNIRmL4dA5AP+2IWMmBoPIlrQUjc5os7lNrYWj3W1UxZh9MLpUosaw7Fpq+NrOQkypsiuvvaVZ8XmyUHi1j1nO39pBtqJDBuMs9MOrQRnnqQmSQcg== 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-08/txt/msg00820.txt.bz2 Yao Qi writes: > On 08/25/2012 01:05 AM, dje@google.com wrote: > >> @@ -1445,15 +1445,12 @@ show_commands (char *args, int from_tty) > > > static void > > > set_history_size_command (char *args, int from_tty, struct cmd_list_element *c) > > > { > > > - if (history_size == INT_MAX) > > > + /* The type of parameter in stifle_history is int, so value from INT_MAX and > > > + up means "unlimited". */ > > > + if (history_size >= INT_MAX) > > > unstifle_history (); > > > - else if (history_size >= 0) > > > - stifle_history (history_size); > > > else > > > - { > > > - history_size = INT_MAX; > > > - error (_("History size must be non-negative")); > > > - } > > > + stifle_history (history_size); > > > } > > > > One issue that arises is if the user sets the value to, say, INT_MAX+1 we call unstifle_history, but show "show hist size" will print INT_MAX+1 instead of "unlimited". > > If we go this route, perhaps any value >= INT_MAX should cause the underlying value to be set to UINT_MAX so that "show" will print "unlimited". > > Good catch! :) I changed this part as below, > > /* The type of parameter in stifle_history is int, so value from INT_MAX up > means 'unlimited'. */ so values from INT_MAX up mean 'unlimited'. > if (history_size > INT_MAX) >= INT_MAX > { > /* Ensure that 'show history size' print 'unlimited'. */ prints 'unlimited'. > history_size = UINT_MAX; > unstifle_history (); > } > else > stifle_history (history_size); Ok with those three changes.