1. 19 Nov, 2015 2 commits
    • Paul Eggert's avatar
      Omit ‘const’ on locals · d9b300af
      Paul Eggert authored
      Remove ‘const’ qualifier from locals that were newly added.
      We don’t normally bother declaring locals with ‘const’ even
      though they are not modified, for the same reason we don’t
      bother declaring them with ‘register’ even though their
      addresses are not taken; the advantage in compile-time
      checking isn’t worth the loss of readability.
      * modules/mod-test/mod-test.c (Fmod_test_non_local_exit_funcall)
      (Fmod_test_vector_fill, Fmod_test_vector_eq):
      * src/emacs-module.c (MODULE_SETJMP_1)
      (module_make_global_ref, module_free_global_ref)
      (module_non_local_exit_get, module_make_function)
      (module_extract_integer, module_extract_float)
      (module_get_user_ptr, module_set_user_ptr)
      (module_get_user_finalizer, module_set_user_finalizer)
      (module_vec_get, Fmodule_call)
      (module_non_local_exit_signal_1)
      (module_non_local_exit_throw_1, lisp_to_value)
      (finalize_storage, allocate_emacs_value, mark_modules)
      (module_handle_signal, module_handle_throw)
      (module_format_fun_env):
      * src/eval.c (push_handler, push_handler_nosignal)
      (init_handler):
      * src/lread.c (suffix_p):
      Omit unnecessary ‘const’.
      d9b300af
    • Juanma Barranquero's avatar
  2. 18 Nov, 2015 1 commit
    • Aurélien Aptel's avatar
      Make 'Fload' look for modules · 218caccd
      Aurélien Aptel authored
      'Fload' can now load dynamic modules. This also makes 'require' work.
      
      * src/lread.c:
        (suffix_p): New function.
        (Fload): Use 'suffix_p'.  Call 'Fmodule_load' when we try to load a file
        with a module suffix.
        (syms_of_lread): Append module suffix to 'Vload_suffixes'.
      218caccd
  3. 08 Nov, 2015 1 commit
    • Paul Eggert's avatar
      Prefer xpalloc to doubling buffers by hand · 8a8613bc
      Paul Eggert authored
      * src/lread.c (grow_read_buffer): New function, which uses xpalloc.
      (read1): Use it for simplicity.
      * src/macros.c (store_kbd_macro_char):
      * src/minibuf.c (read_minibuf_noninteractive):
      * src/term.c (encode_terminal_code):
      * src/xrdb.c (magic_db):
      Prefer xpalloc to growing buffers by hand.
      This doesn’t fix any bugs, but simplifies the code a bit.
      8a8613bc
  4. 29 Oct, 2015 1 commit
  5. 26 Oct, 2015 1 commit
  6. 21 Oct, 2015 1 commit
    • Paul Eggert's avatar
      Include-file cleanup for src directory · 63cfb75f
      Paul Eggert authored
      Omit ‘#include "foo.h"’ unless the file needs foo.h (Bug#21707).
      In a few cases, add ‘#include "foo.h"’ if the file needs foo.h
      but does not include it directly.  As a general rule, a source
      file should include foo.h if it needs the interfaces that foo.h
      defines.
      * src/alloc.c: Don’t include process.h.  Include dispextern.h,
      systime.h.
      * src/atimer.c: Don’t include blockinput.h.
      * src/buffer.c: Include coding.h, systime.h.  Don’t include
      keyboard.h, coding.h.
      * src/callint.c: Don’t include commands.h, keymap.h.
      * src/callproc.c: Don’t include character.h, ccl.h, composite.h,
      systty.h, termhooks.h.
      * src/casetab.c: Don’t include character.h.
      * src/category.c: Don’t include charset.h, keymap.h.
      * src/ccl.h: Don’t include character.h.
      * src/character.c: Don’t include charset.h.
      * src/charset.c: Don’t include disptab.h.
      * src/chartab.c: Don’t include ccl.h.
      * src/cm.c: Don’t include frame.h, termhooks.h.
      * src/cmds.c: Don’t include windo...
      63cfb75f
  7. 16 Sep, 2015 1 commit
    • Paul Eggert's avatar
      Omit unnecessary \ before paren in C docstrings · 032ce1c7
      Paul Eggert authored
      Although \( is needed in docstrings in Elisp code, it is not needed in
      docstrings in C code, since C function definitiions do not start with
      a parenthesis.  The backslashes made the docstrings a bit harder to
      read and to format in columns.  Also, some C docstrings had ( in
      column 1 and this did not appear to be causing any problems.  So,
      simplify C docstrings by replacing \( with ( and \) with ).
      032ce1c7
  8. 27 Aug, 2015 1 commit
    • Paul Eggert's avatar
      Assume GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS · 60d1b187
      Paul Eggert authored
      This removes the need for GCPRO1 etc.  Suggested by Stefan Monnier in:
      http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00918.html
      * doc/lispref/internals.texi (Writing Emacs Primitives):
      * etc/NEWS:
      Document the change.
      * src/alloc.c (gcprolist, dump_zombies, MAX_ZOMBIES, zombies)
      (nzombies, ngcs, avg_zombies, max_live, max_zombies, avg_live)
      (Fgc_status, check_gcpros, relocatable_string_data_p, gc-precise):
      * src/bytecode.c (mark_byte_stack) [BYTE_MARK_STACK]:
      * src/eval.c (gcpro_level) [DEBUG_GCPRO]:
      * src/lisp.h (struct handler.gcpro, struct gcpro, GC_MARK_STACK)
      (GC_USE_GCPROS_AS_BEFORE, GC_MAKE_GCPROS_NOOPS)
      (GC_MARK_STACK_CHECK_GCPROS, GC_USE_GCPROS_CHECK_ZOMBIES)
      (BYTE_MARK_STACK, GCPRO1, GCPRO2, GCPRO3, GCPRO4, GCPRO5, GCPRO6)
      (GCPRO7, UNGCPRO, RETURN_UNGCPRO):
      Remove.  All uses removed.  The code now assumes
      GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS.
      * src/bytecode.c (relocate_byte_stack):
      Rename from unmark_byte_stack, since it now only relocates.
      All callers changed.
      * src/frame.c (make_frame): Add an IF_LINT to pacify GCC 5.2
      with GCPROs removed.
      * src/systime.h: Use EMACS_LISP_H as the canary instead of GCPRO1.
      * test/automated/finalizer-tests.el (finalizer-basic)
      (finalizer-circular-reference, finalizer-cross-reference)
      (finalizer-error):
      * test/automated/generator-tests.el (cps-test-iter-close-finalizer):
      Remove tests, as they depend on gc-precise.
      60d1b187
  9. 26 Aug, 2015 1 commit
    • Paul Eggert's avatar
      format-message now curves ` and ' · 71781c31
      Paul Eggert authored
      That way, the caller doesn’t have to use curved quotes to
      get diagnostics that match the text-quoting-style preferences.
      Suggested by Dmitry Gutov in:
      http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00893.html
      This means we no longer need %qs, so remove that format.
      While we’re at it, fix an unlikely bug and lessen the pressure
      on the garbage collector by processing the string once rather
      than twice in the usual case.
      * doc/lispref/strings.texi (Formatting Strings):
      * etc/NEWS: Document this.
      * lisp/subr.el (format-message): Remove; now done in C.
      * src/callint.c (Fcall_interactively):
      * src/editfns.c (Fmessage, Fmessage_box):
      Use Fformat_message instead of Finternal__text_restyle
      followed by Fformat.
      * src/doc.c (LSQM, RSQM): Remove; all uses changed to use
      uLSQM and uRSQM.
      (Fsubstitute_command_keys): Prefer AUTO_STRING to build_string
      when pure ASCII now suffices.  Fix unlikely bug when parsing
      unibyte string containing non-ASCII bytes.  Use inline code
      rather than memcpy, as it’s a tiny number of bytes.
      (Finternal__text_restyle): Remove; no longer used.
      (syms_of_doc): Don’t declare it.
      * src/editfns.c (Fformat): Rewrite in terms of new function
      ‘styled_format’.
      (Fformat_message): New function, moved here from subr.el.
      (styled_format): New function, with the old guts of Fformat,
      except it now optionally transliterates quotes, and it transliterates
      traditional grave accent and apostrophe quoting as well.
      Remove recently-added q flag; no longer needed or used.
      (syms_of_editfns): Define format-message.
      * src/lisp.h (uLSQM0, uLSQM1, uLSQM2, uRSQM0, uRSQM1, uRSQM2):
      Remove; no longer need to be global symbols.
      * src/xdisp.c (vadd_to_log): Use Fformat_message, not Fformat,
      so that callers can use `%s'.
      * src/image.c (image_size_error, xbm_load_image, xbm_load)
      (xpm_load, pbm_load, png_load_body, jpeg_load_body, tiff_load)
      (gif_load, imagemagick_load_image, imagemagick_load, svg_load)
      (svg_load_image, gs_load, x_kill_gs_process):
      * src/lread.c (load_warn_old_style_backquotes):
      * src/xfaces.c (load_pixmap):
      * src/xselect.c (x_clipboard_manager_error_1):
      Use `%s' instead of %qs in formats.
      71781c31
  10. 19 Aug, 2015 1 commit
    • Paul Eggert's avatar
      Use new q ‘format’ flag when fixing quotes in C · 87fbe1a6
      Paul Eggert authored
      * src/image.c (image_size_error): New function.  All uses of
      image_error with "Invalid image size ..."  changed to use it.
      * src/image.c (image_size_error, xbm_load_image, xbm_load)
      (xpm_load, xpm_load_image, xpm_load, pbm_load, png_load_body)
      (jpeg_load_body, tiff_load, gif_load, imagemagick_load_image)
      (imagemagick_load, svg_load, svg_load_image, gs_load)
      (x_kill_gs_process):
      * src/lread.c (load_warn_old_style_backquotes):
      * src/xfaces.c (load_pixmap):
      * src/xselect.c (x_clipboard_manager_error_1):
      Use %qs, not uLSQM and uRSQM.
      * src/syntax.c (Finternal_describe_syntax_value):
      Prefer Fsubstitute_command_keys to Fformat, as this lets
      us use AUTO_STRING.
      * src/xdisp.c (vadd_to_log): Use AUTO_STRING on the format argument,
      as it's now guaranteed to be ASCII.
      * src/xselect.c (x_clipboard_manager_error_2):
      Avoid grave accent in low-level stderr diagnostic.
      87fbe1a6
  11. 18 Aug, 2015 1 commit
    • Paul Eggert's avatar
      Fix file name encodings in diagnostics · 63673686
      Paul Eggert authored
      Also, close some minor races when opening image files, by opening
      them once instead of multiple times.
      * src/gtkutil.c (xg_get_image_for_pixmap):
      * src/image.c (xpm_load, tiff_load, gif_load, imagemagick_load)
      (svg_load):
      * src/nsimage.m (allocInitFromFile:):
      * src/xfns.c (xg_set_icon):
      Encode file name, since x_find_image_file no longer does that.
      * src/image.c (x_find_image_fd): New function.
      (x_find_image_file): Use it.  Do not encode resulting file name,
      since callers sometimes need it decoded.
      (slurp_file): File arg is now a fd, not a file name.
      All callers changed.  This saves us having to open the file twice.
      (xbm_load, xpm_load, pbm_load, png_load_body, jpeg_load_body)
      (svg_load):
      Use x_find_image_fd and fdopen to save a file-open.
      Report file name that failed.
      * src/lread.c (openp): If PREDICATE is t, open the file in binary mode.
      63673686
  12. 16 Aug, 2015 1 commit
    • Paul Eggert's avatar
      Fix quoting in Fformat calls · 59b5141d
      Paul Eggert authored
      * src/image.c (xbm_read_bitmap_data, xbm_load_image, xbm_load)
      (xpm_load, xpm_load_image, pbm_load, png_load_body)
      (jpeg_load_body, tiff_load, gif_load, imagemagick_load_image)
      (imagemagick_load, svg_load, svg_load_image, gs_load)
      (x_kill_gs_process):
      * src/lread.c (load_warn_old_style_backquotes):
      * src/xfaces.c (load_pixmap):
      * src/xselect.c (x_clipboard_manager_error_1):
      Quote diagnostics according to user preference when calling
      Fformat or its derivatives.
      59b5141d
  13. 11 Aug, 2015 1 commit
    • Paul Eggert's avatar
      Give names to Unicode code points in C code · d6640d6e
      Paul Eggert authored
      * src/character.h (NO_BREAK_SPACE, SOFT_HYPHEN)
      (ZERO_WIDTH_NON_JOINER, ZERO_WIDTH_JOINER, HYPHEN)
      (NON_BREAKING_HYPHEN, LEFT_SINGLE_QUOTATION_MARK)
      (RIGHT_SINGLE_QUOTATION_MARK, PARAGRAPH_SEPARATOR)
      (LEFT_POINTING_ANGLE_BRACKET, RIGHT_POINTING_ANGLE_BRACKET)
      (LEFT_ANGLE_BRACKET, RIGHT_ANGLE_BRACKET)
      (OBJECT_REPLACEMENT_CHARACTER):
      New named constants for Unicode code points.
      * src/bidi.c (bidi_fetch_char, CANONICAL_EQU):
      * src/composite.c (char_composable_p):
      * src/lread.c (readevalloop, read1):
      * src/xdisp.c (get_next_display_element):
      Use them.
      * src/doc.c (LEFT_SINGLE_QUOTATION_POINT):
      Remove; now in character.h.
      d6640d6e
  14. 01 Jun, 2015 1 commit
    • Paul Eggert's avatar
      Avoid grave accent quoting in stderr diagnostics · 2c656f7d
      Paul Eggert authored
      A few Emacs diagnostics go directly to stderr, and so can't easily
      contain curved quotes (as non-UTF-8 locales might mishandle them).
      Instead of bothering to add support for this rarity, reword the
      diagnostics so that they don't use grave accent to quote.
      * src/alloc.c (mark_memory): Fix comment.
      * src/buffer.c (init_buffer):
      * src/dispnew.c (init_display):
      * src/emacs.c (main, sort_args):
      * src/lread.c (dir_warning):
      * src/term.c (init_tty):
      * src/unexmacosx.c (unexec):
      * src/xfns.c (select_visual):
      * src/xterm.c (cvt_string_to_pixel, x_io_error_quitter):
      Reword stderr diagnostics to avoid quoting `like this'.
      * src/unexmacosx.c: Include errno.h.
      * src/xfns.c (select_visual): Encode value for locale.
      2c656f7d
  15. 06 May, 2015 1 commit
    • Stefan Monnier's avatar
      * lisp/emacs-lisp/testcover.el: Don't use edebug--read (bug#20487) · 1340aefd
      Stefan Monnier authored
      * lisp/emacs-lisp/testcover.el: Use lexical-binding.
      (testcover--read): Rename from testcover-read.  Change calling convention.
      Use edebug-read-and-maybe-wrap-form now that edebug-read is gone.
      (testcover-start): Use add-function.  Move edebug-all-defs binding to
      testcover--read.
      (testcover-this-defun): Tighten scope of edebug-all-defs binding.
      (testcover-mark): Remove unused var `item'.
      
      * src/lread.c (syms_of_lread): Default load-read-function to `read'.
      1340aefd
  16. 22 Apr, 2015 1 commit
    • Paul Eggert's avatar
      Omit needless "\ " after multibyte then newline · 7128b0de
      Paul Eggert authored
      * src/print.c: Include <c-ctype.h>, for c_isxdigit.
      (print_object): When print-escape-multibyte is non-nil and a
      multibyte character is followed by a newline or formfeed, followed
      by a hex digit, don't output a needless "\ " before the hex digit.
      * test/automated/print-tests.el (print-hex-backslash): New test.
      7128b0de
  17. 15 Apr, 2015 1 commit
  18. 27 Mar, 2015 1 commit
  19. 20 Feb, 2015 1 commit
    • Paul Eggert's avatar
      Simplify binary I/O configuration · 3bbf5170
      Paul Eggert authored
      * lib-src/etags.c: Include <sysstdio.h> rather than <stdio.h>.
      (process_file_name, analyze_regex): Use FOPEN_BINARY rather than
      hard-coded "b".
      * src/lread.c (Fload): Prefer FOPEN_TEXT and FOPEN_BINARY to
      #ifdef DOS_NT.
      * src/sysstdio.h: Add copyright notice.  Include <fcntl.h>.
      (FOPEN_BINARY, FOPEN_TEXT): New macros.
      * src/xfaces.c (Fx_load_color_file): Use FOPEN_TEXT, since POSIX
      doesn't guarantee that "t" will work.
      3bbf5170
  20. 09 Feb, 2015 1 commit
    • Paul Eggert's avatar
      Use C99's INFINITY and NAN macros · 2f700871
      Paul Eggert authored
      * lread.c: Include <math.h>.
      (string_to_number): Use INFINITY and NAN rather than rolling our own.
      This avoids some runtime diagnostics when building with
      gcc -fsanitize=undefined.
      2f700871
  21. 25 Jan, 2015 1 commit
    • Paul Eggert's avatar
      Count MANY function args more reliably · a3689d3c
      Paul Eggert authored
      * alloc.c (Fgc_status, purecopy, unbind_to, garbage_collect_1):
      * buffer.c (Fbuffer_list, Fkill_buffer):
      * callint.c (read_file_name, Fcall_interactively):
      * charset.c (Fset_charset_priority, syms_of_charset):
      * chartab.c (uniprop_encode_value_numeric):
      * coding.c (syms_of_coding):
      * composite.c (syms_of_composite):
      * data.c (wrong_range):
      * dbusbind.c (syms_of_dbusbind):
      * dired.c (file_attributes):
      * editfns.c (Fdecode_time, update_buffer_properties, format2):
      * eval.c (run_hook_with_args_2, apply1, call1, call2, call3)
      (call4, call5, call6, call7):
      * fileio.c (Finsert_file_contents, choose_write_coding_system)
      (Fcar_less_than_car, build_annotations, auto_save_error):
      * filelock.c (get_boot_time):
      * fns.c (internal_equal, nconc2, Fyes_or_no_p, Fwidget_apply):
      (maybe_resize_hash_table, secure_hash):
      * font.c (font_style_to_value, font_open_by_name, Flist_fonts):
      * fontset.c (fontset_add, Fset_fontset_font):
      * ftfont.c (ftfont_lookup_cache):
      * gtkutil.c (xg_get_font):
      * insdel.c (signal_before_change, signal_after_change):
      * keymap.c (append_key):
      * lread.c (load_warn_old_style_backquotes, Fload, init_lread):
      * minibuf.c (Fread_buffer):
      * print.c (print_preprocess):
      * process.c (Fformat_network_address, Fmake_network_process)
      (server_accept_connection):
      * sound.c (Fplay_sound_internal):
      * term.c (Fsuspend_tty, Fresume_tty):
      * window.c (window_list):
      * xdisp.c (run_redisplay_end_trigger_hook, add_to_log)
      (message_with_string):
      * xfaces.c (Fx_list_fonts):
      * xfont.c (syms_of_xfont):
      * xselect.c (x_handle_selection_request)
      (x_handle_selection_clear, x_clear_frame_selections)
      (x_clipboard_manager_error_1):
      Prefer CALLMANY and CALLN to counting args by hand.
      * doc.c (reread_doc_file): Remove unused code.
      * fns.c (concat2, concat3): Redo to avoid need for local-var vector.
      (cmpfn_user_defined, hashfn_user_defined, Fmaphash):
      Prefer call1 and call2 to Ffuncall.
      * keyboard.c (safe_run_hook_funcall, safe_run_hooks):
      Use struct literal rather than a local var, for simplicity.
      * keymap.c (where_is_internal): Use NULL rather than a pointer
      to unused args.
      * lisp.h (CALLMANY, CALLN): New macros.
      * sound.c (Fplay_sound_internal): Coalesce duplicate code.
      Fixes: bug#19634
      a3689d3c
  22. 10 Jan, 2015 1 commit
    • Paul Eggert's avatar
      Port to 32-bit --with-wide-int · 6a37ecee
      Paul Eggert authored
      Prefer symbol indexes to struct Lisp_Symbol * casted and then
      widened, as the latter had trouble with GCC on Fedora 21 when
      configured --with-wide-int and when used in static initializers.
      * lib-src/make-docfile.c (write_globals): Define and use symbols like
      iQnil (a small integer, like 0) rather than aQnil (an address
      constant).
      * src/alloc.c (garbage_collect_1, which_symbols):
      * src/lread.c (init_obarray):
      Prefer builtin_lisp_symbol when it can be used.
      * src/dispextern.h (struct image_type.type):
      * src/font.c (font_property_table.key):
      * src/frame.c (struct frame_parm_table.sym):
      * src/keyboard.c (scroll_bar_parts, struct event_head):
      * src/xdisp.c (struct props.name):
      Use the index of a builtin symbol rather than its address.
      All uses changed.
      * src/lisp.h (TAG_SYMPTR, XSYMBOL_INIT): Remove, replacing with ...
      (TAG_SYMOFFSET, SYMBOL_INDEX): ... new macros that deal with
      symbol indexes rather than pointers, and which work better on MSB
      hosts because they shift right before tagging.  All uses changed.
      (DEFINE_LISP_SYMBOL_BEGIN, DEFINE_LISP_SYMBOL_END):
      No longer noops on wide-int hosts, since they work now.
      (builtin_lisp_symbol): New function.
      6a37ecee
  23. 05 Jan, 2015 1 commit
    • Paul Eggert's avatar
      Compute C decls for DEFSYMs automatically · 58f2d6ef
      Paul Eggert authored
      Fixes Bug#15880.
      This patch also makes Q constants (e.g., Qnil) constant addresses
      from the C point of view.
      * make-docfile.c: Revamp to generate table of symbols, too.
      Include <stdbool.h>.
      (xstrdup): New function.
      (main): Don't process the same file twice.
      (SYMBOL): New constant in enum global_type.
      (struct symbol): Turn 'value' member into a union, either v.value
      for int or v.svalue for string.  All uses changed.
      (add_global): New arg svalue, which overrides value, so that globals
      can have a string value.
      (close_emacs_global): New arg num_symbols; all uses changed.
      Output lispsym decl.
      (write_globals): Output symbol globals too.  Output more
      ATTRIBUTE_CONST, now that Qnil etc. are C constants.
      Output defsym_name table.
      (scan_c_file): Move most of guts into ...
      (scan_c_stream): ... new function.  Scan for DEFSYMs and
      record symbols found.  Don't read past EOF if file doesn't
      end in newline.
      * alloc.c, bidi.c, buffer.c, bytecode.c, callint.c, casefiddle:
      * casetab.c, category.c, ccl.c, charset.c, chartab.c, cmds.c, coding.c:
      * composite.c, data.c, dbusbind.c, decompress.c, dired.c, dispnew.c:
      * doc.c, editfns.c, emacs.c, eval.c, fileio.c, fns.c, font.c, fontset.c:
      * frame.c, fringe.c, ftfont.c, ftxfont.c, gfilenotify.c, gnutls.c:
      * image.c, inotify.c, insdel.c, keyboard.c, keymap.c, lread.c:
      * macfont.m, macros.c, minibuf.c, nsfns.m, nsfont.m, nsimage.m:
      * nsmenu.m, nsselect.m, nsterm.m, print.c, process.c, profiler.c:
      * search.c, sound.c, syntax.c, term.c, terminal.c, textprop.c, undo.c:
      * window.c, xdisp.c, xfaces.c, xfns.c, xftfont.c, xmenu.c, xml.c:
      * xselect.c, xsettings.c, xterm.c:
      Remove Q vars that represent symbols (e.g., Qnil, Qt, Qemacs).
      These names are now defined automatically by make-docfile.
      * alloc.c (init_symbol): New function.
      (Fmake_symbol): Use it.
      (c_symbol_p): New function.
      (valid_lisp_object_p, purecopy): Use it.
      * alloc.c (marked_pinned_symbols):
      Use make_lisp_symbol instead of make_lisp_ptr.
      (garbage_collect_1): Mark lispsym symbols.
      (CHECK_ALLOCATED_AND_LIVE_SYMBOL): New macro.
      (mark_object): Use it.
      (sweep_symbols): Sweep lispsym symbols.
      (symbol_uses_obj): New function.
      (which_symbols): Use it.  Work for lispsym symbols, too.
      (init_alloc_once): Initialize Vpurify_flag here; no need to wait,
      since Qt's address is already known now.
      (syms_of_alloc): Add lispsym count to symbols_consed.
      * buffer.c (init_buffer_once): Compare to Qnil, not to make_number (0),
      when testing whether storage is all bits zero.
      * dispextern (struct image_type):
      * font.c (font_property_table):
      * frame.c (struct frame_parm_table, frame_parms):
      * keyboard.c (scroll_bar_parts, struct event_head):
      * xdisp.c (struct props):
      Use XSYMBOL_INIT (Qfoo) and struct Lisp_Symbol * rather than &Qfoo and
      Lisp_Object *, since Qfoo is no longer an object whose address can be
      taken.  All uses changed.
      * eval.c (run_hook): New function.  Most uses of Frun_hooks changed to
      use it, so that they no longer need to take the address of a Lisp sym.
      (syms_of_eval): Don't use DEFSYM on Vrun_hooks, as it's a variable.
      * frame.c (syms_of_frame): Add defsyms for the frame_parms table.
      * keyboard.c (syms_of_keyboard): Don't DEFSYM Qmenu_bar here.
      DEFSYM Qdeactivate_mark before the corresponding var.
      * keymap.c (syms_of_keymap): Use DEFSYM for Qmenu_bar and Qmode_line
      instead of interning their symbols; this avoids duplicates.
      (LISP_INITIALLY, TAG_PTR)
      (DEFINE_LISP_SYMBOL_BEGIN, DEFINE_LISP_SYMBOL_END, XSYMBOL_INIT):
      New macros.
      (LISP_INITIALLY_ZERO): Use it.
      (enum symbol_interned, enum symbol_redirect, struct Lisp_Symbol)
      (EXFUN, DEFUN_ARGS_MANY, DEFUN_ARGS_UNEVALLED, DEFUN_ARGS_*):
      Move decls up, to avoid forward uses.  Include globals.h earlier, too.
      (make_lisp_symbol): New function.
      (XSETSYMBOL): Use it.
      (DEFSYM): Now just a placeholder for make-docfile.
      * lread.c (DEFINE_SYMBOLS): Define, for globals.h.
      (intern_sym): New function, with body taken from old intern_driver.
      (intern_driver): Use it.  Last arg is now Lisp integer, not ptrdiff_t.
      All uses changed.
      (define_symbol): New function.
      (init_obarray): Define the C symbols taken from lispsym.
      Use plain DEFSYM for Qt and Qnil.
      * syntax.c (init_syntax_once): No need to worry about
      Qchar_table_extra_slots.
      58f2d6ef
  24. 01 Jan, 2015 2 commits
  25. 16 Dec, 2014 1 commit
  26. 07 Nov, 2014 1 commit
    • Paul Eggert's avatar
      Uniquify the 'size' symbol. · 0e44a2d2
      Paul Eggert authored
      * frame.c (Qsize):
      * w32notify.c (Qsize): Remove.
      * lisp.h (Qsize): New decl.
      * lread.c (Qsize): Now extern.
      * w32notify.c (syms_of_w32notify): No need to defsym.
      0e44a2d2
  27. 12 Oct, 2014 1 commit
  28. 02 Oct, 2014 1 commit
  29. 01 Oct, 2014 1 commit
    • Paul Eggert's avatar
      Use AUTO_CONS instead of SCOPED_CONS, etc. · 27900ac7
      Paul Eggert authored
      * doc/lispref/internals.texi (Stack-allocated Objects):
      Adjust to match the revised, less error-prone macros.
      * src/frame.h (AUTO_FRAME_ARG): Rename from FRAME_PARAMETER.
      * src/lisp.h (AUTO_CONS): Rename from scoped_cons.
      (AUTO_LIST1): Rename from scoped_list1.
      (AUTO_LIST2): Rename from scoped_list2.
      (AUTO_LIST3): Rename from scoped_list3.
      (AUTO_LIST4): Rename from scoped_list4.
      (AUTO_STRING): Rename from SCOPED_STRING.
      * src/frame.h (AUTO_FRAME_ARG):
      * src/lisp.h (AUTO_CONS, AUTO_LIST1, AUTO_LIST2, AUTO_LIST3)
      (AUTO_LIST4, AUTO_STRING):
      Prepend a new argument 'name'.
      Declare a variable instead of yielding a value.
      All uses changed.
      * src/lisp.h (STACK_CONS, AUTO_CONS_EXPR): New internal macros.
      27900ac7
  30. 30 Sep, 2014 1 commit
    • Paul Eggert's avatar
      Simplify stack-allocated Lisp objects, and make them more portable. · dc452569
      Paul Eggert authored
      The build_local_string macro was used in two ways: (1) string
      literals for which scoped allocation suffices, and (2) file name
      components, where it's not safe in general to assume bounded-size
      ASCII data.  Simplify by defining a new macro SCOPED_STRING that
      allocates a block-scope string, and by using SCOPED_STRING for (1)
      and build_string for (2).  Furthermore, actually use stack
      allocation only for objects known to have sufficient alignment.
      This simpler implementation means Emacs can make
      USE_STACK_LISP_OBJECTS the default unless GC_MARK_STACK !=
      GC_MAKE_GCPROS_NOOPS.
      * lisp.h (GCALIGNED): Align even if !USE_STACK_LISP_OBJECTS,
      for fewer differences among implementations.
      (struct Lisp_String): Now GCALIGNED.
      (USE_STACK_LISP_OBJECTS): Default to true, since the
      implementation no longer insists on a nonempty GCALIGNED.
      But make it false if GC_MARK_STACK != GC_MAKE_GCPROS_NOOPS.
      (SCOPED_CONS_INITIALIZER): Remove, since it's no longer needed
      separately.  Move definiens to scoped_cons.  The old definition
      was incorrect when GCALIGNED was defined to be empty.
      (union Aligned_String): New type.
      (USE_STACK_CONS, USE_STACK_STRING): New constants, so that the
      implementation ports to compilers that don't align strictly enough.
      Don't worry about the union sizes; it's not worth bothering about.
      (scoped_cons, scoped_list1, scoped_list3, scoped_list4):
      Rewrite using USE_STACK_CONS.
      (scoped_cons): Assume the use of union Aligned_Cons.
      (lisp_string_size, make_local_string, build_local_string): Remove.
      Unless otherwise specified, all callers of build_local_string
      changed to use SCOPED_STRING.
      (SCOPED_STRING): New macro.
      * data.c (wrong_choice):
      * menu.c (single_menu_item):
      * process.c (Fformat_network_address):
      Hoist use of SCOPED_STRING out of a scope, so that its returned
      object lives long enough.
      * fileio.c (Fexpand_file_name): Use build_string, not SCOPED_STRING,
      as the string might be long or might not be ASCII.
      dc452569
  31. 29 Sep, 2014 1 commit
    • Dmitry Antipov's avatar
      Keep stack-allocated Lisp objects fast rather than versatile. · 71a72686
      Dmitry Antipov authored
      * configure.ac (HAVE_STATEMENT_EXPRESSIONS): Remove.
      For USE_STACK_LISP_OBJECTS, we always assume __GNUC__.
      * lisp.h (union Aligned_Cons) [!GCALIGNED]: Define as such.
      (SCOPED_CONS_INITIALIZER): New macro.
      (scoped_cons) [USE_STACK_LISP_OBJECTS]: Use it.
      (USE_LOCAL_ALLOCA): Remove.
      (local_cons, local_list1, local_list2, local_list3, local_list4):
      Remove.  Stack overflow checking makes them too slow.
      (make_local_vector): Likewise.  Also we just don't have enough
      users for it.
      (enum LISP_STRING_OVERHEAD): Remove.
      (local_string_init, local_vector_init): Remove prototypes.
      (make_local_string, build_local_string): Redesign to target short
      compile-time string constants, fall back to regular string allocation
      where appropriate.
      (lisp_string_size): New function.
      (verify_ascii) [ENABLE_CHECKING]: Add prototype.
      * alloc.c (local_string_init, local_vector_init): Remove.
      (verify_ascii) [ENABLE_CHECKING]: New function.
      * buffer.c, charset.c, chartab.c, data.c, editfns.c, emacs.c, fileio.c:
      * fns.c, font.c, fontset.c, frame.c, keyboard.c, keymap.c, lread.c:
      * menu.c, minibuf.c, process.c, textprop.c, xdisp.c, xfns.c, xfont.c:
      * xselect.c, xterm.c: All related users changed.
      71a72686
  32. 25 Sep, 2014 1 commit
    • Paul Eggert's avatar
      Fix local_cons etc. to not exhaust the stack when in a loop. · 10381f58
      Paul Eggert authored
      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.
      10381f58
  33. 22 Sep, 2014 1 commit
  34. 16 Sep, 2014 1 commit
    • Dmitry Antipov's avatar
      If USE_LOCAL_ALLOCATORS, allocate even more Lisp objects on stack. · b98b1a83
      Dmitry Antipov authored
      * 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.
      b98b1a83
  35. 15 Sep, 2014 1 commit
    • Dmitry Antipov's avatar
      If USE_LOCAL_ALLOCATORS, allocate some Lisp objects on stack. · edb0288b
      Dmitry Antipov authored
      * lisp.h (local_cons, local_list1, local_list2, local_list3)
      [USE_LOCAL_ALLOCATORS]: New macros.
      [!USE_LOCAL_ALLOCATORS]: Fall back to regular functions.
      (build_local_string): Avoid argument name expansion clash with
      make_local_string.
      * alloc.c (toplevel)
      [USE_LOCAL_ALLOCATORS && GC_MARK_STACK != GC_MAKE_GCPROS_NOOPS]:
      Preprocessor guard to avoid impossible configuration.
      * charset.c (Ffind_charset_region, Ffind_charset_string):
      Use make_local_vector.
      * lread.c (read1, substitute_object_recurse): Use scoped_cons.
      * textprop.c (Fput_text_property, Fadd_face_text_property):
      Use scoped_list2.
      (copy_text_properties): Use local_cons and local_list3.
      * chartab.c (uniprop_table):
      * data.c (wrong_choice, wrong_range):
      * doc.c (get_doc_string):
      * editfns.c (format2):
      * fileio.c (Fexpand_file_name, auto_save_error):
      * fns.c (Fyes_or_no_p):
      * font.c (font_parse_xlfd, font_parse_family_registry, font_add_log):
      * fontset.c (Fset_fontset_font):
      * keyboard.c (echo_add_key, echo_dash, parse_menu_item)
      (read_char_minibuf_menu_prompt):
      * keymap.c (silly_event_symbol_error, describe_vector):
      * menu.c (single_menu_item):
      * minibuf.c (Fread_buffer):
      * process.c (status_message, Fformat_network_address)
      (server_accept_connection): Use make_local_string and
      build_local_string.  Prefer compound literals where appropriate.
      edb0288b
  36. 11 Sep, 2014 1 commit
  37. 07 Sep, 2014 1 commit
    • Paul Eggert's avatar
      Use SAFE_ALLOCA etc. to avoid unbounded stack allocation. · b3bf18b3
      Paul Eggert authored
      This follows up on the recent thread in emacs-devel on alloca; see:
      http://lists.gnu.org/archive/html/emacs-devel/2014-09/msg00042.html
      This patch also cleans up alloca-related glitches noted while
      examining the code looking for unbounded alloca.
      * alloc.c (listn):
      * callproc.c (init_callproc):
      Rewrite to avoid need for alloca.
      * buffer.c (mouse_face_overlay_overlaps)
      (report_overlay_modification):
      * buffer.h (GET_OVERLAYS_AT):
      * coding.c (make_subsidiaries):
      * doc.c (Fsnarf_documentation):
      * editfns.c (Fuser_full_name):
      * fileio.c (Ffile_name_directory, Fexpand_file_name)
      (search_embedded_absfilename, Fsubstitute_in_file_name):
      * fns.c (Fmake_hash_table):
      * font.c (font_vconcat_entity_vectors, font_update_drivers):
      * fontset.c (fontset_pattern_regexp, Ffontset_info):
      * frame.c (Fmake_terminal_frame, x_set_frame_parameters)
      (xrdb_get_resource, x_get_resource_string):
      * ftfont.c (ftfont_get_charset, ftfont_check_otf, ftfont_drive_otf):
      * ftxfont.c (ftxfont_draw):
      * image.c (xbm_load, xpm_load, jpeg_load_body):
      * keyboard.c (echo_add_key, menu_bar_items, tool_bar_items):
      * keymap.c (Fdescribe_buffer_bindings, describe_map):
      * lread.c (openp):
      * menu.c (digest_single_submenu, find_and_call_menu_selection)
      (find_and_return_menu_selection):
      * print.c (PRINTFINISH):
      * process.c (Fformat_network_address):
      * scroll.c (do_scrolling, do_direct_scrolling, scrolling_1):
      * search.c (search_buffer, Fmatch_data, Fregexp_quote):
      * sound.c (wav_play, au_play):
      * syntax.c (skip_chars):
      * term.c (tty_menu_activate, tty_menu_show):
      * textprop.c (get_char_property_and_overlay):
      * window.c (Fset_window_configuration):
      * xdisp.c (safe__call, next_overlay_change, vmessage)
      (compute_overhangs_and_x, draw_glyphs, note_mouse_highlight):
      * xfaces.c (face_at_buffer_position):
      * xmenu.c (x_menu_show):
      Use SAFE_ALLOCA etc. instead of plain alloca, since the
      allocation size isn't bounded.
      * callint.c (Fcall_interactively): Redo memory_full check
      so that it can be done at compile-time on some platforms.
      * coding.c (MAX_LOOKUP_MAX): New constant.
      (get_translation_table): Use it.
      * callproc.c (call_process): Use SAFE_NALLOCA instead of
      SAFE_ALLOCA, to catch integer overflows on size calculation.
      (exec_failed) [!DOS_NT]: New function.
      (child_setup) [!DOS_NT]: Use it.
      * editfns.c (Ftranspose_regions):
      Hoist USE_SAFE_ALLOC + SAFE_FREE out of 'if'.
      * editfns.c (check_translation):
      Allocate larger buffers on the heap.
      * eval.c (internal_lisp_condition_case):
      Check for MAX_ALLOCA overflow.
      * fns.c (sort_vector): Use SAFE_ALLOCA_LISP rather than Fmake_vector.
      (Fbase64_encode_region, Fbase64_decode_region):
      Avoid unnecessary calls to SAFE_FREE before 'error'.
      * buffer.c (mouse_face_overlay_overlaps):
      * editfns.c (Fget_pos_property, check_translation):
      * eval.c (Ffuncall):
      * font.c (font_unparse_xlfd, font_find_for_lface):
      * ftfont.c (ftfont_drive_otf):
      * keyboard.c (echo_add_key, read_decoded_event_from_main_queue)
      (menu_bar_items, tool_bar_items):
      * sound.c (Fplay_sound_internal):
      * xdisp.c (load_overlay_strings, dump_glyph_row):
      Use an ordinary auto buffer rather than alloca, since the
      allocation size is fixed and small.
      * ftfont.c: Include <c-strcase.h>.
      (matching_prefix): New function.
      (get_adstyle_property): Use it, to avoid need for alloca.
      * keyboard.c (echo_add_key):
      * keymap.c (describe_map): Use ptrdiff_t, not int.
      * keyboard.c (echo_add_key): Prefer sizeof to strlen.
      * keymap.c (Fdescribe_buffer_bindings): Use SBYTES, not SCHARS,
      when counting bytes.
      * lisp.h (xlispstrdupa): Remove, replacing with ...
      (SAFE_ALLOCA_STRING): ... new macro with different API.
      This fixes a portability problem, namely, alloca result
      passed to another function.  All uses changed.
      (SAFE_ALLOCA, SAFE_ALLOCA_LISP): Check for MAX_ALLOCA,
      not MAX_ALLOCA - 1.
      * regex.c (REGEX_USE_SAFE_ALLOCA, REGEX_SAFE_FREE)
      (REGEX_ALLOCATE): New macros.
      (REGEX_REALLOCATE, REGEX_ALLOCATE_STACK, REGEX_REALLOCATE_STACK)
      (REGEX_FREE_STACK, FREE_VARIABLES, re_match_2_internal):
      Use them.
      * xdisp.c (message3): Use SAFE_ALLOCA_STRING rather than doing it
      by hand.
      (decode_mode_spec_coding): Store directly into buf rather than
      into an alloca temporary and copying the temporary to the buf.
      
      Fixes: debbugs:18410
      b3bf18b3
  38. 01 Sep, 2014 1 commit
    • Dmitry Antipov's avatar
      Avoid extra calls to strlen in filesystem I/O routines. · 50e9e580
      Dmitry Antipov authored
      * fileio.c (Fexpand_file_name): Avoid calls to strlen if
      the length of 'newdir' is known or may be precalculated.
      (file_accessible_directory_p): Prefer to pass Lisp_Object,
      not 'char *', and so use precalculated length.
      (Ffile_accessible_directory_p):
      * callproc.c (encode_current_directory, init_callproc):
      * charset.c (init_charset):
      * lread.c (load_path_check, load_path_default): Adjust users.
      * lisp.h (file_accessible_directory_p): Tweak prototype.
      50e9e580