summaryrefslogtreecommitdiff
path: root/src/dbusbind.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2017-10-04 14:29:58 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2017-10-04 14:45:08 -0700
commit3db388b0bf83d3138562f09ce25fab8ba89bcc81 (patch)
treeff86fa2e529cdd9187a12e88d193b4416d60c26e /src/dbusbind.c
parent4e0b67ed27114fa2cbebca32567089fd8fa78425 (diff)
downloademacs-3db388b0bf83d3138562f09ce25fab8ba89bcc81.tar.gz
emacs-3db388b0bf83d3138562f09ce25fab8ba89bcc81.tar.bz2
emacs-3db388b0bf83d3138562f09ce25fab8ba89bcc81.zip
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.
Diffstat (limited to 'src/dbusbind.c')
-rw-r--r--src/dbusbind.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/dbusbind.c b/src/dbusbind.c
index 789aa008611..4a7068416fe 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -237,8 +237,7 @@ static char *
XD_OBJECT_TO_STRING (Lisp_Object object)
{
AUTO_STRING (format, "%s");
- Lisp_Object args[] = { format, object };
- return SSDATA (styled_format (ARRAYELTS (args), args, false, false));
+ return SSDATA (CALLN (Fformat, format, object));
}
#define XD_DBUS_VALIDATE_BUS_ADDRESS(bus) \