From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] emacs-26 3db388b: Speed up (format "%s" STRING) and the like Date: Fri, 6 Oct 2017 10:45:27 -0700 Organization: UCLA Computer Science Department Message-ID: References: <20171004214511.1405.22257@vcs0.savannah.gnu.org> <20171004214513.6A40E2041C@vcs0.savannah.gnu.org> <4fc424a0-fc11-2565-5bdb-c8691bf0323d@cs.ucla.edu> <83h8vexd94.fsf@gnu.org> <83k209whwr.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------D23A018525CD61DF1782F7B0" X-Trace: blaine.gmane.org 1507312103 18534 195.159.176.226 (6 Oct 2017 17:48:23 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 6 Oct 2017 17:48:23 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 Cc: Eli Zaretskii , emacs-devel@gnu.org, monnier@iro.umontreal.ca, oleh@oremacs.com To: Kaushal Modi Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Oct 06 19:48:18 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e0WjR-0004Ba-Fc for ged-emacs-devel@m.gmane.org; Fri, 06 Oct 2017 19:48:17 +0200 Original-Received: from localhost ([::1]:46597 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e0WjY-0008To-N7 for ged-emacs-devel@m.gmane.org; Fri, 06 Oct 2017 13:48:24 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41309) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e0Wgt-00073C-8h for emacs-devel@gnu.org; Fri, 06 Oct 2017 13:45:40 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e0Wgs-0006JC-0F for emacs-devel@gnu.org; Fri, 06 Oct 2017 13:45:39 -0400 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:38792) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e0Wgo-0006DR-0C; Fri, 06 Oct 2017 13:45:34 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 1AF5B160E5C; Fri, 6 Oct 2017 10:45:32 -0700 (PDT) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id ORqkhoTAFW6f; Fri, 6 Oct 2017 10:45:31 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 135FC160E5D; Fri, 6 Oct 2017 10:45:31 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id wbnDLdMMAQ5V; Fri, 6 Oct 2017 10:45:30 -0700 (PDT) Original-Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id E61B0160E5C; Fri, 6 Oct 2017 10:45:30 -0700 (PDT) In-Reply-To: Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 131.179.128.68 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:219202 Archived-At: This is a multi-part message in MIME format. --------------D23A018525CD61DF1782F7B0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 10/05/2017 05:47 PM, Kaushal Modi wrote: > Please try the below method now and see if that helps you recreate the > issue: Thanks, that did the trick. I reproduced the problem on an RHEL 6.9 platform. The problem was due to a significant typo in one of my earlier commits, a typo that was exposed by the commit that you mentioned. To fix it, I installed the attached patch into emacs-26 and merged emacs-26 to master. --------------D23A018525CD61DF1782F7B0 Content-Type: text/x-patch; name="0001-Fix-bug-in-recent-styled_format-change.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-Fix-bug-in-recent-styled_format-change.patch" >From 9226cf325421a168b42bd27abf5e171e877b48b9 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 6 Oct 2017 10:32:46 -0700 Subject: [PATCH] Fix bug in recent styled_format change Problem reported by Kaushal Modi in: http://lists.gnu.org/archive/html/emacs-devel/2017-10/msg00141.html * src/editfns.c (styled_format): Fix bug where USE_SAFE_ALLOCA was not always followed by SAFE_FREE. This bug was introduced in my patch 2017-09-26T23:31:57Z!eggert@cs.ucla.edu entitled "Avoid some unnecessary copying in Fformat etc." --- src/editfns.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/editfns.c b/src/editfns.c index d88a913c66..e65bd34da8 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -4179,6 +4179,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message) multibyte character of the previous string. This flag tells if we must consider such a situation or not. */ bool maybe_combine_byte; + Lisp_Object val; bool arg_intervals = false; USE_SAFE_ALLOCA; sa_avail -= sizeof initial_buffer; @@ -4417,7 +4418,10 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message) { if (format == end && format - format_start == 2 && ! string_intervals (args[0])) - return arg; + { + val = arg; + goto return_val; + } /* handle case (precision[n] >= 0) */ @@ -4862,11 +4866,14 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message) emacs_abort (); if (! new_result) - return args[0]; + { + val = args[0]; + goto return_val; + } if (maybe_combine_byte) nchars = multibyte_chars_in_text ((unsigned char *) buf, p - buf); - Lisp_Object val = make_specified_string (buf, nchars, p - buf, multibyte); + val = make_specified_string (buf, nchars, p - buf, multibyte); /* If the format string has text properties, or any of the string arguments has text properties, set up text properties of the @@ -4964,6 +4971,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message) } } + return_val: /* If we allocated BUF or INFO with malloc, free it too. */ SAFE_FREE (); -- 2.13.6 --------------D23A018525CD61DF1782F7B0--