From: Paul Eggert <eggert@cs.ucla.edu>
To: Kaushal Modi <kaushal.modi@gmail.com>
Cc: Eli Zaretskii <eliz@gnu.org>,
emacs-devel@gnu.org, monnier@iro.umontreal.ca, oleh@oremacs.com
Subject: Re: [Emacs-diffs] emacs-26 3db388b: Speed up (format "%s" STRING) and the like
Date: Fri, 6 Oct 2017 10:45:27 -0700 [thread overview]
Message-ID: <f19bae81-a8c3-dad7-b1e1-e3e41e7228df@cs.ucla.edu> (raw)
In-Reply-To: <CAFyQvY3354jEh4E1qBknyMJAvjMrPwrTOOtnBTVi3cHr8bv8WQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 428 bytes --]
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.
[-- Attachment #2: 0001-Fix-bug-in-recent-styled_format-change.patch --]
[-- Type: text/x-patch, Size: 2213 bytes --]
From 9226cf325421a168b42bd27abf5e171e877b48b9 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
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
next prev parent reply other threads:[~2017-10-06 17:45 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20171004214511.1405.22257@vcs0.savannah.gnu.org>
[not found] ` <20171004214513.6A40E2041C@vcs0.savannah.gnu.org>
2017-10-05 3:09 ` [Emacs-diffs] emacs-26 3db388b: Speed up (format "%s" STRING) and the like Stefan Monnier
2017-10-05 6:07 ` Paul Eggert
2017-10-05 7:30 ` Eli Zaretskii
2017-10-05 13:20 ` Stefan Monnier
2017-10-05 16:57 ` Kaushal Modi
2017-10-05 17:08 ` Kaushal Modi
2017-10-05 17:09 ` Kaushal Modi
2017-10-05 18:47 ` Eli Zaretskii
2017-10-05 20:13 ` Kaushal Modi
2017-10-05 21:44 ` Paul Eggert
2017-10-06 0:47 ` Kaushal Modi
2017-10-06 17:45 ` Paul Eggert [this message]
2017-10-06 17:49 ` Kaushal Modi
2017-10-06 18:06 ` Paul Eggert
2017-10-06 18:15 ` Kaushal Modi
2017-10-06 18:21 ` Kaushal Modi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f19bae81-a8c3-dad7-b1e1-e3e41e7228df@cs.ucla.edu \
--to=eggert@cs.ucla.edu \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=kaushal.modi@gmail.com \
--cc=monnier@iro.umontreal.ca \
--cc=oleh@oremacs.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.