diff options
| author | Paul Eggert | 2014-09-24 19:01:14 -0700 |
|---|---|---|
| committer | Paul Eggert | 2014-09-24 19:01:14 -0700 |
| commit | 10381f58949355413c86315c571508afb40f0de6 (patch) | |
| tree | 06761cfffeb1dcd54a633da833b7f0021f1b71c0 /src/buffer.c | |
| parent | 59355ea9ce310eb45b33e10f2ffaedbc4e2f47a9 (diff) | |
| download | emacs-10381f58949355413c86315c571508afb40f0de6.tar.gz emacs-10381f58949355413c86315c571508afb40f0de6.zip | |
Fix local_cons etc. to not exhaust the stack when in a loop.
Problem reported in:
http://lists.gnu.org/archive/html/emacs-devel/2014-09/msg00696.html
* buffer.c (Fother_buffer, other_buffer_safely, init_buffer):
* charset.c (load_charset_map_from_file, Ffind_charset_region)
(Ffind_charset_string):
* chartab.c (uniprop_encode_value_numeric, uniprop_table):
* data.c (wrong_range):
* editfns.c (Fpropertize, format2):
* emacs.c (init_cmdargs, decode_env_path):
* fileio.c (auto_save_error):
* fns.c (Fyes_or_no_p):
* font.c (font_style_to_value, font_parse_xlfd)
(font_parse_family_registry, font_delete_unmatched)
(font_add_log):
* fontset.c (Fset_fontset_font):
* frame.c (x_get_arg):
* keyboard.c (echo_dash, safe_run_hooks_error, parse_menu_item)
(read_char_minibuf_menu_prompt):
* keymap.c (silly_event_symbol_error, describe_vector):
* lread.c (load_warn_old_style_backquotes):
* menu.c (single_menu_item):
* minibuf.c (Fread_buffer):
* process.c (status_message, Fformat_network_address)
(server_accept_connection):
* textprop.c (copy_text_properties):
* xdisp.c (Fcurrent_bidi_paragraph_direction):
* xfns.c (x_default_scroll_bar_color_parameter):
* xfont.c (xfont_open):
* xselect.c (x_clipboard_manager_error_1):
* xterm.c (x_term_init):
Put USE_LOCAL_ALLOCA at the start of the function.
* fns.c (maybe_resize_hash_table): Use build_string instead of
build_local_string, since we'd otherwise need a conditional
USE_LOCAL_ALLOCA here, but this is just debugging output and is
not worth the bother of optimization.
* font.c (font_delete_unmatched): Remove by-hand code that
observed MAX_ALLOCA limit, since it's now done automatically.
* keymap.c (Fsingle_key_description): Put USE_SAFE_ALLOCA at top,
since build_local_string needs its sa_alloc.
* lisp.h (lisp_word_count): New function.
(SAFE_ALLOCA_LISP): Use it.
(USE_LOCAL_ALLOCA): New macro.
(local_cons, make_local_vector, make_local_string):
Observe the MAX_ALLOCA limit.
(LISP_STRING_OVERHEAD): New constant.
(make_local_string): Use it.
Diffstat (limited to 'src/buffer.c')
| -rw-r--r-- | src/buffer.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/buffer.c b/src/buffer.c index dc2d17f9f67..591f585a7a9 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -1509,8 +1509,9 @@ frame's buffer list. | |||
| 1509 | The buffer is found by scanning the selected or specified frame's buffer | 1509 | The buffer is found by scanning the selected or specified frame's buffer |
| 1510 | list first, followed by the list of all buffers. If no other buffer | 1510 | list first, followed by the list of all buffers. If no other buffer |
| 1511 | exists, return the buffer `*scratch*' (creating it if necessary). */) | 1511 | exists, return the buffer `*scratch*' (creating it if necessary). */) |
| 1512 | (register Lisp_Object buffer, Lisp_Object visible_ok, Lisp_Object frame) | 1512 | (Lisp_Object buffer, Lisp_Object visible_ok, Lisp_Object frame) |
| 1513 | { | 1513 | { |
| 1514 | USE_LOCAL_ALLOCA; | ||
| 1514 | struct frame *f = decode_any_frame (frame); | 1515 | struct frame *f = decode_any_frame (frame); |
| 1515 | Lisp_Object tail = f->buffer_list, pred = f->buffer_predicate; | 1516 | Lisp_Object tail = f->buffer_list, pred = f->buffer_predicate; |
| 1516 | Lisp_Object buf, notsogood = Qnil; | 1517 | Lisp_Object buf, notsogood = Qnil; |
| @@ -1569,6 +1570,7 @@ exists, return the buffer `*scratch*' (creating it if necessary). */) | |||
| 1569 | Lisp_Object | 1570 | Lisp_Object |
| 1570 | other_buffer_safely (Lisp_Object buffer) | 1571 | other_buffer_safely (Lisp_Object buffer) |
| 1571 | { | 1572 | { |
| 1573 | USE_LOCAL_ALLOCA; | ||
| 1572 | Lisp_Object tail, buf; | 1574 | Lisp_Object tail, buf; |
| 1573 | 1575 | ||
| 1574 | FOR_EACH_LIVE_BUFFER (tail, buf) | 1576 | FOR_EACH_LIVE_BUFFER (tail, buf) |
| @@ -5238,6 +5240,7 @@ init_buffer_once (void) | |||
| 5238 | void | 5240 | void |
| 5239 | init_buffer (int initialized) | 5241 | init_buffer (int initialized) |
| 5240 | { | 5242 | { |
| 5243 | USE_LOCAL_ALLOCA; | ||
| 5241 | char *pwd; | 5244 | char *pwd; |
| 5242 | Lisp_Object temp; | 5245 | Lisp_Object temp; |
| 5243 | ptrdiff_t len; | 5246 | ptrdiff_t len; |