diff options
| author | Dmitry Antipov | 2012-07-09 16:02:27 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2012-07-09 16:02:27 +0400 |
| commit | a8290ec31c89dfdec85fc9d46000c66c0caa1697 (patch) | |
| tree | a1fcee6481bc8ef358abdeec12a15fcfd9c53649 /src/alloc.c | |
| parent | 27505cf5e4d61283be5368cfd200c942dded0c79 (diff) | |
| download | emacs-a8290ec31c89dfdec85fc9d46000c66c0caa1697.tar.gz emacs-a8290ec31c89dfdec85fc9d46000c66c0caa1697.zip | |
Use make_formatted_string to avoid double length calculation.
* lisp.h (make_formatted_string): New prototype.
* alloc.c (make_formatted_string): New function.
* buffer.c (Fgenerate_new_buffer_name): Use it.
* dbus.c (syms_of_dbusbind): Likewise.
* editfns.c (Fcurrent_time_zone): Likewise.
* filelock.c (get_boot_time): Likewise.
* frame.c (make_terminal_frame, set_term_frame_name)
(x_report_frame_params): Likewise.
* image.c (gs_load): Likewise.
* minibuf.c (get_minibuffer): Likewise.
* msdos.c (dos_set_window_size): Likewise.
* process.c (make_process): Likewise.
* xdisp.c (ensure_echo_area_buffers): Likewise.
* xsettings.c (apply_xft_settings): Likewise.
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/alloc.c b/src/alloc.c index 88f96c41a15..739ec40c45c 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -2517,6 +2517,20 @@ make_uninit_multibyte_string (EMACS_INT nchars, EMACS_INT nbytes) | |||
| 2517 | return string; | 2517 | return string; |
| 2518 | } | 2518 | } |
| 2519 | 2519 | ||
| 2520 | /* Print arguments to BUF according to a FORMAT, then return | ||
| 2521 | a Lisp_String initialized with the data from BUF. */ | ||
| 2522 | |||
| 2523 | Lisp_Object | ||
| 2524 | make_formatted_string (char *buf, const char *format, ...) | ||
| 2525 | { | ||
| 2526 | va_list ap; | ||
| 2527 | ptrdiff_t length; | ||
| 2528 | |||
| 2529 | va_start (ap, format); | ||
| 2530 | length = vsprintf (buf, format, ap); | ||
| 2531 | va_end (ap); | ||
| 2532 | return make_string (buf, length); | ||
| 2533 | } | ||
| 2520 | 2534 | ||
| 2521 | 2535 | ||
| 2522 | /*********************************************************************** | 2536 | /*********************************************************************** |