From b98b1a831bcfc89f038cbb8048c6969d8c73ab28 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Tue, 16 Sep 2014 12:20:08 +0400 Subject: [PATCH] If USE_LOCAL_ALLOCATORS, allocate even more Lisp objects on stack. * charset.c (load_charset_map_from_file): Use scoped_list2 and build_local_string. * buffer.c (Fother_buffer, other_buffer_safely, init_buffer): * emacs.c (init_cmdargs, decode_env_path): * fileio.c (Fexpand_file_name): * fns.c (maybe_resize_hash_table) [ENABLE_CHECKING]: * frame.c (x_get_arg): * keyboard.c (safe_run_hooks_error): * lread.c (load_warn_old_style_backquotes): * xdisp.c (Fcurrent_bidi_paragraph_direction): * xfns.c (x_default_scroll_bar_color_parameter, select_visual): * xselect.c (x_clipboard_manager_error_1) (x_clipboard_manager_save_all): * xterm.c (x_term_init): Use build_local_string. --- src/ChangeLog | 18 ++++++++++++++++++ src/buffer.c | 12 ++++++------ src/charset.c | 3 ++- src/data.c | 2 +- src/emacs.c | 6 +++--- src/fileio.c | 2 +- src/fns.c | 9 +++------ src/frame.c | 7 +++---- src/keyboard.c | 9 +++------ src/lread.c | 9 +++------ src/xdisp.c | 2 +- src/xfns.c | 23 +++++++++++------------ src/xselect.c | 16 +++++++--------- src/xterm.c | 23 +++++++++-------------- 14 files changed, 71 insertions(+), 70 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 2258f58299e..a920ac1b970 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,21 @@ +2014-09-16 Dmitry Antipov + + If USE_LOCAL_ALLOCATORS, allocate even more Lisp objects on stack. + * charset.c (load_charset_map_from_file): Use scoped_list2 + and build_local_string. + * buffer.c (Fother_buffer, other_buffer_safely, init_buffer): + * emacs.c (init_cmdargs, decode_env_path): + * fileio.c (Fexpand_file_name): + * fns.c (maybe_resize_hash_table) [ENABLE_CHECKING]: + * frame.c (x_get_arg): + * keyboard.c (safe_run_hooks_error): + * lread.c (load_warn_old_style_backquotes): + * xdisp.c (Fcurrent_bidi_paragraph_direction): + * xfns.c (x_default_scroll_bar_color_parameter, select_visual): + * xselect.c (x_clipboard_manager_error_1) + (x_clipboard_manager_save_all): + * xterm.c (x_term_init): Use build_local_string. + 2014-09-15 Eli Zaretskii * sound.c [WINDOWSNT]: Include w32common.h and mbstring.h. diff --git a/src/buffer.c b/src/buffer.c index 566a9a1b576..a68afc6cd4f 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -1552,10 +1552,10 @@ exists, return the buffer `*scratch*' (creating it if necessary). */) return notsogood; else { - buf = Fget_buffer (build_string ("*scratch*")); + buf = Fget_buffer (build_local_string ("*scratch*")); if (NILP (buf)) { - buf = Fget_buffer_create (build_string ("*scratch*")); + buf = Fget_buffer_create (build_local_string ("*scratch*")); Fset_buffer_major_mode (buf); } return buf; @@ -1575,10 +1575,10 @@ other_buffer_safely (Lisp_Object buffer) if (candidate_buffer (buf, buffer)) return buf; - buf = Fget_buffer (build_string ("*scratch*")); + buf = Fget_buffer (build_local_string ("*scratch*")); if (NILP (buf)) { - buf = Fget_buffer_create (build_string ("*scratch*")); + buf = Fget_buffer_create (build_local_string ("*scratch*")); Fset_buffer_major_mode (buf); } @@ -5289,7 +5289,7 @@ init_buffer (int initialized) initialized = initialized; #endif /* USE_MMAP_FOR_BUFFERS */ - Fset_buffer (Fget_buffer_create (build_string ("*scratch*"))); + Fset_buffer (Fget_buffer_create (build_local_string ("*scratch*"))); if (NILP (BVAR (&buffer_defaults, enable_multibyte_characters))) Fset_buffer_multibyte (Qnil); @@ -5328,7 +5328,7 @@ init_buffer (int initialized) && strcmp ("/", SSDATA (BVAR (current_buffer, directory)))) bset_directory (current_buffer, - concat2 (build_string ("/:"), BVAR (current_buffer, directory))); + concat2 (build_local_string ("/:"), BVAR (current_buffer, directory))); temp = get_minibuffer (0); bset_directory (XBUFFER (temp), BVAR (current_buffer, directory)); diff --git a/src/charset.c b/src/charset.c index a7bae9d7b01..3ccac8684be 100644 --- a/src/charset.c +++ b/src/charset.c @@ -490,7 +490,8 @@ load_charset_map_from_file (struct charset *charset, Lisp_Object mapfile, int n_entries; ptrdiff_t count; - suffixes = list2 (build_string (".map"), build_string (".TXT")); + suffixes = scoped_list2 (build_local_string (".map"), + build_local_string (".TXT")); count = SPECPDL_INDEX (); record_unwind_protect_nothing (); diff --git a/src/data.c b/src/data.c index 2d6d4c7c22b..414da4cf6f7 100644 --- a/src/data.c +++ b/src/data.c @@ -983,7 +983,7 @@ wrong_choice (Lisp_Object choice, Lisp_Object wrong) USE_SAFE_ALLOCA; SAFE_ALLOCA_LISP (args, len * 2 + 1); - args[i++] = build_string ("One of "); + args[i++] = build_local_string ("One of "); for (obj = choice; !NILP (obj); obj = XCDR (obj)) { diff --git a/src/emacs.c b/src/emacs.c index 9b05d68b914..ed218a7d90b 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -423,7 +423,7 @@ init_cmdargs (int argc, char **argv, int skip_args, char *original_pwd) if it would otherwise be treated as magic. */ handler = Ffind_file_name_handler (raw_name, Qt); if (! NILP (handler)) - raw_name = concat2 (build_string ("/:"), raw_name); + raw_name = concat2 (build_local_string ("/:"), raw_name); Vinvocation_name = Ffile_name_nondirectory (raw_name); Vinvocation_directory = Ffile_name_directory (raw_name); @@ -441,7 +441,7 @@ init_cmdargs (int argc, char **argv, int skip_args, char *original_pwd) if it would otherwise be treated as magic. */ handler = Ffind_file_name_handler (found, Qt); if (! NILP (handler)) - found = concat2 (build_string ("/:"), found); + found = concat2 (build_local_string ("/:"), found); Vinvocation_directory = Ffile_name_directory (found); } } @@ -2323,7 +2323,7 @@ decode_env_path (const char *evarname, const char *defalt, bool empty) } if (! NILP (tem)) - element = concat2 (build_string ("/:"), element); + element = concat2 (build_local_string ("/:"), element); } /* !NILP (element) */ lpath = Fcons (element, lpath); diff --git a/src/fileio.c b/src/fileio.c index 0b508eae197..80905c63d3a 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -1111,7 +1111,7 @@ filesystem tree, not (expand-file-name ".." dirname). */) name = make_specified_string (nm, -1, p - nm, multibyte); temp[0] = DRIVE_LETTER (drive); - name = concat2 (build_string (temp), name); + name = concat2 (build_local_string (temp), name); } #ifdef WINDOWSNT if (!NILP (Vw32_downcase_file_names)) diff --git a/src/fns.c b/src/fns.c index 9f56a8f01f5..afe293b6dd3 100644 --- a/src/fns.c +++ b/src/fns.c @@ -3994,12 +3994,9 @@ maybe_resize_hash_table (struct Lisp_Hash_Table *h) #ifdef ENABLE_CHECKING if (HASH_TABLE_P (Vpurify_flag) && XHASH_TABLE (Vpurify_flag) == h) - { - Lisp_Object args[2]; - args[0] = build_string ("Growing hash table to: %d"); - args[1] = make_number (new_size); - Fmessage (2, args); - } + Fmessage (2, ((Lisp_Object []) + { build_local_string ("Growing hash table to: %d"), + make_number (new_size) })); #endif set_hash_key_and_value (h, larger_vector (h->key_and_value, diff --git a/src/frame.c b/src/frame.c index 94100312346..cba69373c41 100644 --- a/src/frame.c +++ b/src/frame.c @@ -4162,10 +4162,9 @@ x_get_arg (Display_Info *dpyinfo, Lisp_Object alist, Lisp_Object param, { if (attribute && dpyinfo) { - tem = display_x_get_resource (dpyinfo, - build_string (attribute), - build_string (class), - Qnil, Qnil); + tem = display_x_get_resource + (dpyinfo, build_local_string (attribute), + build_local_string (class), Qnil, Qnil); if (NILP (tem)) return Qunbound; diff --git a/src/keyboard.c b/src/keyboard.c index a114aa27626..f79c1c94167 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -1894,16 +1894,13 @@ safe_run_hooks_1 (ptrdiff_t nargs, Lisp_Object *args) static Lisp_Object safe_run_hooks_error (Lisp_Object error, ptrdiff_t nargs, Lisp_Object *args) { - Lisp_Object hook, fun, msgargs[4]; + Lisp_Object hook, fun; eassert (nargs == 2); hook = args[0]; fun = args[1]; - msgargs[0] = build_string ("Error in %s (%S): %S"); - msgargs[1] = hook; - msgargs[2] = fun; - msgargs[3] = error; - Fmessage (4, msgargs); + Fmessage (4, ((Lisp_Object []) + { build_local_string ("Error in %s (%S): %S"), hook, fun, error })); if (SYMBOLP (hook)) { diff --git a/src/lread.c b/src/lread.c index fabd2010035..f285312e592 100644 --- a/src/lread.c +++ b/src/lread.c @@ -969,12 +969,9 @@ static void load_warn_old_style_backquotes (Lisp_Object file) { if (!NILP (Vold_style_backquotes)) - { - Lisp_Object args[2]; - args[0] = build_string ("Loading `%s': old-style backquotes detected!"); - args[1] = file; - Fmessage (2, args); - } + Fmessage (2, ((Lisp_Object []) + { build_local_string ("Loading `%s': old-style backquotes detected!"), + file })); } DEFUN ("get-load-suffixes", Fget_load_suffixes, Sget_load_suffixes, 0, 0, 0, diff --git a/src/xdisp.c b/src/xdisp.c index 1c6362d0345..b697b803049 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -20884,7 +20884,7 @@ See also `bidi-paragraph-direction'. */) the previous non-empty line. */ if (pos >= ZV && pos > BEGV) DEC_BOTH (pos, bytepos); - if (fast_looking_at (build_string ("[\f\t ]*\n"), + if (fast_looking_at (build_local_string ("[\f\t ]*\n"), pos, bytepos, ZV, ZV_BYTE, Qnil) > 0) { while ((c = FETCH_BYTE (bytepos)) == '\n' diff --git a/src/xfns.c b/src/xfns.c index ec915a69f80..683adb2b210 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -1571,13 +1571,13 @@ x_default_scroll_bar_color_parameter (struct frame *f, /* See if an X resource for the scroll bar color has been specified. */ - tem = display_x_get_resource (dpyinfo, - build_string (foreground_p - ? "foreground" - : "background"), - empty_unibyte_string, - build_string ("verticalScrollBar"), - empty_unibyte_string); + tem = display_x_get_resource + (dpyinfo, build_local_string (foreground_p + ? "foreground" + : "background"), + empty_unibyte_string, + build_local_string ("verticalScrollBar"), + empty_unibyte_string); if (!STRINGP (tem)) { /* If nothing has been specified, scroll bars will use a @@ -4273,13 +4273,12 @@ select_visual (struct x_display_info *dpyinfo) { Display *dpy = dpyinfo->display; Screen *screen = dpyinfo->screen; - Lisp_Object value; /* See if a visual is specified. */ - value = display_x_get_resource (dpyinfo, - build_string ("visualClass"), - build_string ("VisualClass"), - Qnil, Qnil); + Lisp_Object value = display_x_get_resource + (dpyinfo, build_local_string ("visualClass"), + build_local_string ("VisualClass"), Qnil, Qnil); + if (STRINGP (value)) { /* VALUE should be of the form CLASS-DEPTH, where CLASS is one diff --git a/src/xselect.c b/src/xselect.c index 6a54b397626..0bc7fbc204a 100644 --- a/src/xselect.c +++ b/src/xselect.c @@ -2159,11 +2159,10 @@ x_clipboard_manager_save (Lisp_Object frame) static Lisp_Object x_clipboard_manager_error_1 (Lisp_Object err) { - Lisp_Object args[2]; - args[0] = build_string ("X clipboard manager error: %s\n\ -If the problem persists, set `x-select-enable-clipboard-manager' to nil."); - args[1] = CAR (CDR (err)); - Fmessage (2, args); + Fmessage (2, ((Lisp_Object []) + { build_local_string ("X clipboard manager error: %s\n\ +If the problem persists, set `x-select-enable-clipboard-manager' to nil."), + CAR (CDR (err)) })); return Qnil; } @@ -2230,10 +2229,9 @@ x_clipboard_manager_save_all (void) local_frame = XCAR (XCDR (XCDR (XCDR (local_selection)))); if (FRAME_LIVE_P (XFRAME (local_frame))) { - Lisp_Object args[1]; - args[0] = build_string ("Saving clipboard to X clipboard manager..."); - Fmessage (1, args); - + Fmessage (1, ((Lisp_Object []) + { build_local_string + ("Saving clipboard to X clipboard manager...") })); internal_condition_case_1 (x_clipboard_manager_save, local_frame, Qt, x_clipboard_manager_error_2); } diff --git a/src/xterm.c b/src/xterm.c index 8b34167b5ad..1426546d3ae 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -10946,10 +10946,9 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) if (dpyinfo->visual->class == PseudoColor) { Lisp_Object value; - value = display_x_get_resource (dpyinfo, - build_string ("privateColormap"), - build_string ("PrivateColormap"), - Qnil, Qnil); + value = display_x_get_resource + (dpyinfo, build_local_string ("privateColormap"), + build_local_string ("PrivateColormap"), Qnil, Qnil); if (STRINGP (value) && (!strcmp (SSDATA (value), "true") || !strcmp (SSDATA (value), "on"))) @@ -11156,11 +11155,9 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) /* See if we should run in synchronous mode. This is useful for debugging X code. */ { - Lisp_Object value; - value = display_x_get_resource (dpyinfo, - build_string ("synchronous"), - build_string ("Synchronous"), - Qnil, Qnil); + Lisp_Object value = display_x_get_resource + (dpyinfo, build_local_string ("synchronous"), + build_local_string ("Synchronous"), Qnil, Qnil); if (STRINGP (value) && (!strcmp (SSDATA (value), "true") || !strcmp (SSDATA (value), "on"))) @@ -11168,11 +11165,9 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) } { - Lisp_Object value; - value = display_x_get_resource (dpyinfo, - build_string ("useXIM"), - build_string ("UseXIM"), - Qnil, Qnil); + Lisp_Object value = display_x_get_resource + (dpyinfo, build_local_string ("useXIM"), + build_local_string ("UseXIM"), Qnil, Qnil); #ifdef USE_XIM if (STRINGP (value) && (!strcmp (SSDATA (value), "false") -- 2.39.5