Speed up (format "%s" STRING) and the like
commit3db388b0bf83d3138562f09ce25fab8ba89bcc81
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 4 Oct 2017 21:29:58 +0000 (4 14:29 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 4 Oct 2017 21:45:08 +0000 (4 14:45 -0700)
treeff86fa2e529cdd9187a12e88d193b4416d60c26e
parent4e0b67ed27114fa2cbebca32567089fd8fa78425
Speed up (format "%s" STRING) and the like

Although the Lisp manual said that ‘format’ returns a
newly-allocated string, this was not true for a few cases like
(format "%s" ""), and fixing the documentation to allow reuse of
arguments lets us improve performance in common cases like
(format "foo") and (format "%s" "foo") (Bug#28625).
* doc/lispref/strings.texi (Formatting Strings):
* etc/NEWS:
Say that the result of ‘format’ might not be newly allocated.
* src/callint.c (Fcall_interactively):
* src/dbusbind.c (XD_OBJECT_TO_STRING):
* src/editfns.c (Fmessage, Fmessage_box):
* src/xdisp.c (vadd_to_log, Ftrace_to_stderr):
Just use Fformat or Fformat_message, as that’s simpler and no
longer makes unnecessary copies.
* src/editfns.c (styled_format): Remove last argument, as it
is no longer needed: all callers now want it to behave as if it
were true.  All remaining callers changed.  Make this function
static again.  Simplify the function now that we no longer
need to worry about whether the optimization is allowed.
doc/lispref/strings.texi
etc/NEWS
src/callint.c
src/dbusbind.c
src/editfns.c
src/lisp.h
src/xdisp.c