From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Chris K. Jester-Young" Newsgroups: gmane.lisp.guile.devel Subject: Re: [PATCH] Implement efficient 'scm_unget_bytes' and use it Date: Sat, 6 Apr 2013 03:39:13 -0400 Message-ID: <20130406073913.GA20669@lotus.destinee.acro.gen.nz> References: <87d2u8uq9t.fsf@tines.lan> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1365278538 28487 80.91.229.3 (6 Apr 2013 20:02:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 6 Apr 2013 20:02:18 +0000 (UTC) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sat Apr 06 22:02:19 2013 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UOZIb-0007UX-Ky for guile-devel@m.gmane.org; Sat, 06 Apr 2013 22:01:17 +0200 Original-Received: from localhost ([::1]:42183 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UONj5-0008QT-Jr for guile-devel@m.gmane.org; Sat, 06 Apr 2013 03:39:51 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:53460) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UONiz-0008Lk-Kl for guile-devel@gnu.org; Sat, 06 Apr 2013 03:39:48 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UONiy-0001Ox-6d for guile-devel@gnu.org; Sat, 06 Apr 2013 03:39:45 -0400 Original-Received: from mail-gh0-f178.google.com ([209.85.160.178]:49567) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UONiy-0001Or-2a for guile-devel@gnu.org; Sat, 06 Apr 2013 03:39:44 -0400 Original-Received: by mail-gh0-f178.google.com with SMTP id g24so734269ghb.9 for ; Sat, 06 Apr 2013 00:39:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:date:from:to:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=+L0os95C2jnftfuVvOoTUWuypaLc5i8trK8pp20n6VM=; b=YTSrS320o21yaoWoE0w/aUd8a2XZwLBukI1Y9FbydLZClQAKkFao7KR2bYnI0LkBUG bTEP+ozlF2SZs3hi796FE95whWatqbHzAzGu0l0LAb2sgYBFl7kkThsFceA7vIoTpk8i 16F69Z6OHRUwmmdV1UkX5UOTKez9U9p8DlkcOPMRKJZr6V5doIhWP7PjAsufoiyD4/xo mtQqDAa8gZ3+y+CP4Phru+lCE3OhkCn7aOP7UmnfDknJE8c4XuGt0HDztkVvZV7vlVmZ oKtnvzccIBiY5NrXn5SiW/+WiYyJELxtaJPz3Ys10pw2e4XqdMxpEsQBRvYQbOf7qi48 N6Sg== X-Received: by 10.236.115.97 with SMTP id d61mr8320141yhh.136.1365233983610; Sat, 06 Apr 2013 00:39:43 -0700 (PDT) Original-Received: from lotus.destinee.acro.gen.nz (cpe-107-015-120-110.nc.res.rr.com. [107.15.120.110]) by mx.google.com with ESMTPS id a26sm26136688yhe.9.2013.04.06.00.39.40 (version=TLSv1 cipher=RC4-SHA bits=128/128); Sat, 06 Apr 2013 00:39:41 -0700 (PDT) Content-Disposition: inline In-Reply-To: <87d2u8uq9t.fsf@tines.lan> User-Agent: Mutt/1.5.20 (2009-06-14) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.160.178 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:16162 Archived-At: On Sat, Apr 06, 2013 at 02:28:14AM -0400, Mark H Weaver wrote: > This patch implements a function 'scm_unget_bytes' that enables large > buffers to be unread efficiently. It keeps the bytes at the end of the > buffer instead of the beginning, but it can cope if some external code > manipulates the pushback buffer by hand and puts the bytes at the > beginning. Looks good to me! I did write a comment on IRC about how the following lines + if (new_len > pt->read_buf_size) + /* The putback buffer needs to be enlarged. */ used inconsistent references to "read_buf" and "putback buffer", but I don't think there's a very good solution for that, other than just making the human reader aware that read_buf _is_ putback_buf in this context. Cheers, Chris.