1. 21 Feb, 2015 1 commit
    • Paul Eggert's avatar
      Prefer 'Qfoo' to 'intern ("foo")' · 3ebf0630
      Paul Eggert authored
      * buffer.c (syms_of_buffer):
      * bytecode.c (exec_byte_code):
      * callint.c (Fcall_interactively):
      * callproc.c (create_temp_file):
      * charset.c (define_charset_internal):
      * coding.c (syms_of_coding):
      * editfns.c (syms_of_editfns):
      * emacs.c (main):
      * fns.c (syms_of_fns):
      * frame.c (delete_frame, Fframe_parameters):
      * keyboard.c (syms_of_keyboard):
      * keymap.c (syms_of_keymap):
      * minibuf.c (read_minibuf, syms_of_minibuf):
      * nsfns.m (ns_cursor_type_to_lisp):
      * textprop.c (syms_of_textprop):
      * xdisp.c (Fformat_mode_line, syms_of_xdisp):
      * xfns.c (x_create_tip_frame, Fx_select_font):
      * xml.c (parse_region):
      Prefer constants like 'Qfoo' to calls like 'intern ("foo")'.
      * buffer.c (syms_of_buffer): OK to do (put 'erase-buffer 'disabled
      t) here now ...
      (keys_of_buffer): ... instead of here.
      * ftfont.c (syms_of_ftfont): Move DEFSYM of Qmono from here ...
      * xfns.c (syms_of_xfns): ... to here, since ftfont.c is more
      optional than xfns.c.
      3ebf0630
  2. 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
  3. 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
  4. 01 Jan, 2015 2 commits
  5. 12 Oct, 2014 1 commit
  6. 08 Oct, 2014 1 commit
    • Leo Liu's avatar
      Enhance terpri to allow conditionally output a newline · 2dbd7a37
      Leo Liu authored
      * doc/lispref/streams.texi (Output Functions): Document new argument ENSURE to
      terpri.
      
      * doc/misc/cl.texi (Porting Common Lisp): Remove parse-integer.
      
      * lisp/emacs-lisp/cl-extra.el (cl-fresh-line): New function.
      
      * src/keymap.c (describe_vector_princ):
      * src/keyboard.c (Fcommand_error_default_function): Adapt to change to
      Fterpri.
      
      * src/print.c (printchar_stdout_last): Declare.
      (printchar): Record the last char written to stdout.
      (Fterpri): Add optional argument ENSURE.
      
      * test/automated/print-tests.el: New file.
      (terpri): Tests for terpri.  (Bug#18652)
      2dbd7a37
  7. 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
  8. 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
  9. 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
  10. 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
  11. 24 Sep, 2014 1 commit
  12. 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
  13. 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
  14. 14 Jul, 2014 1 commit
  15. 02 Jul, 2014 1 commit
  16. 12 Jun, 2014 1 commit
  17. 05 Apr, 2014 1 commit
    • Paul Eggert's avatar
      Prefer 'ARRAYELTS (x)' to 'sizeof x / sizeof *x'. · faa52174
      Paul Eggert authored
      * alloc.c (memory_full):
      * charset.c (syms_of_charset):
      * doc.c (Fsnarf_documentation):
      * emacs.c (main):
      * font.c (BUILD_STYLE_TABLE):
      * keyboard.c (make_lispy_event):
      * profiler.c (setup_cpu_timer):
      * xgselect.c (xg_select):
      * xterm.c (record_event, STORE_KEYSYM_FOR_DEBUG):
      Use ARRAYELTS.
      * font.c (FONT_PROPERTY_TABLE_SIZE): Remove.
      Replace the only use with ARRAYELTS (font_property_table).
      * xfaces.c (DIM): Remove.  All uses replaced by ARRAYELTS.
      faa52174
  18. 01 Jan, 2014 1 commit
  19. 25 Dec, 2013 1 commit
    • Chong Yidong's avatar
      Doc updates for several Emacs 24.4 changes. · c9352587
      Chong Yidong authored
      * doc/lispref/commands.texi (Event Input Misc): Document new arg to
      input-pending-p.
      
      * doc/lispref/display.texi (Font Selection): Tweak example.
      
      * doc/lispref/keymaps.texi (Active Keymaps): Re-organize the text.
      (Searching Keymaps): Rewrite the pseudo-code for 24.4 changes.
      (Controlling Active Maps): Note that set-transient-map uses
      overriding-terminal-local-map.
      
      * doc/lispref/nonascii.texi (Specifying Coding Systems): Don't refer to
      emacs-mule-dos.
      (Lisp and Coding Systems): Describe emacs-mule return value in
      modern terms.
      
      * doc/lispref/tips.texi (Coding Conventions): Tweak the coding system tip;
      Emacs now uses utf-8 by default for Emacs Lisp source files.
      
      * doc/emacs/glossary.texi (Glossary): Define MULE in modern terms.
      
      * src/keyboard.c (Voverriding_terminal_local_map):
      (Voverriding_local_map): Doc fix.
      
      * src/keymap.c (Vemulation_mode_map_alists): Doc fix.
      c9352587
  20. 16 Nov, 2013 1 commit
  21. 11 Aug, 2013 1 commit
    • Paul Eggert's avatar
      Omit some unnecessary casts. · 7d652d97
      Paul Eggert authored
      Many of these go back to the old pre-C89 days, when they may have
      been needed, but we've been assuming C89 or later for a while now.
      * alloc.c (live_string_p, live_cons_p, live_symbol_p)
      (live_float_p, live_misc_p, live_vector_p):
      * buffer.c (compare_overlays, cmp_for_strings, mmap_find)
      (mmap_alloc, alloc_buffer_text, enlarge_buffer_text)
      (defvar_per_buffer):
      * callint.c (Fcall_interactively):
      * doc.c (Fsubstitute_command_keys):
      * filelock.c (get_boot_time):
      * frame.c (xrdb_get_resource):
      * gtkutil.c (hierarchy_ch_cb, qttip_cb, style_changed_cb)
      (delete_cb, xg_dialog_response_cb, xg_maybe_add_timer)
      (xg_get_file_name_from_selector, menuitem_destroy_callback)
      (menuitem_highlight_callback, menu_destroy_callback)
      (xg_update_menu_item, xg_modify_menubar_widgets, menubar_map_cb)
      (xg_tool_bar_callback, xg_get_tool_bar_widgets)
      (xg_tool_bar_detach_callback, xg_tool_bar_attach_callback)
      (xg_tool_bar_help_callback, tb_size_cb):
      * image.c (xpm_alloc_color, png_read_from_memory)
      (png_read_from_file, png_load_body, our_memory_skip_input_data)
      (jpeg_memory_src, jpeg_file_src, imagemagick_load_image)
      (syms_of_image):
      * keymap.c (describe_map):
      * nsfns.m (Fns_display_monitor_attributes_list):
      * nsmenu.m (process_dialog:):
      * nsterm.m (hold_event):
      * process.c (wait_reading_process_output):
      * regex.c (REGEX_REALLOCATE, re_set_registers, re_exec, regexec):
      * scroll.c (do_direct_scrolling, scrolling_1):
      * termcap.c (tgetent):
      * window.c (check_window_containing, add_window_to_list)
      (freeze_window_starts):
      * xdisp.c (compare_overlay_entries, vmessage):
      * xfns.c (x_window, x_get_monitor_attributes_xinerama)
      (x_get_monitor_attributes_xrandr)
      (Fx_display_monitor_attributes_list, x_display_info_for_name)
      (Fx_open_connection, file_dialog_cb, file_dialog_unmap_cb):
      * xfont.c (xfont_match, xfont_open):
      * xmenu.c (x_menu_wait_for_event, menu_highlight_callback)
      (menubar_selection_callback, menu_position_func)
      (popup_selection_callback, create_and_show_popup_menu)
      (dialog_selection_callback, create_and_show_dialog):
      * xrdb.c (x_get_string_resource):
      (main) [TESTRM]:
      * xsmfns.c (x_session_check_input):
      * xterm.c (x_draw_glyphless_glyph_string_foreground)
      (xm_scroll_callback, xg_scroll_callback, xg_end_scroll_callback)
      (xaw_jump_callback, xaw_scroll_callback):
      Omit unnecessary casts.
      7d652d97
  22. 19 Jul, 2013 1 commit
    • Paul Eggert's avatar
      Fix obscure porting bug with varargs functions. · 1396ac86
      Paul Eggert authored
      The code assumed that int is treated like ptrdiff_t in a vararg
      function, which is not a portable assumption.  There was a similar
      -- though these days less likely -- porting problem with various
      assumptions that pointers of different types all smell the same as
      far as vararg functions is conserved.  To make this problem less
      likely in the future, redo the API to use varargs functions.
      * alloc.c (make_save_value): Remove this vararg function.
      All uses changed to ...
      (make_save_int_int_int, make_save_obj_obj_obj_obj)
      (make_save_ptr_int, make_save_funcptr_ptr_obj, make_save_memory):
      New functions.
      (make_save_ptr): Rename from make_save_pointer, for consistency with
      the above.  Define only on platforms that need it.  All uses changed.
      1396ac86
  23. 16 Jul, 2013 1 commit
    • Paul Eggert's avatar
      Prefer list1 (X) to Fcons (X, Qnil) when building lists. · 6c6f1994
      Paul Eggert authored
      This makes the code easier to read and the executable a bit smaller.
      Do not replace all calls to Fcons that happen to create lists,
      just calls that are intended to create lists.  For example, when
      creating an alist that maps FOO to nil, use list1 (Fcons (FOO, Qnil))
      rather than list1 (list1 (FOO)) or Fcons (Fcons (FOO, Qnil), Qnil).
      Similarly for list2 through list5.
      * buffer.c (Fget_buffer_create, Fmake_indirect_buffer):
      * bytecode.c (exec_byte_code):
      * callint.c (quotify_arg, Fcall_interactively):
      * callproc.c (Fcall_process, create_temp_file):
      * charset.c (load_charset_map_from_file)
      (Fdefine_charset_internal, init_charset):
      * coding.c (get_translation_table, detect_coding_system)
      (Fcheck_coding_systems_region)
      (Fset_terminal_coding_system_internal)
      (Fdefine_coding_system_internal, Fdefine_coding_system_alias):
      * composite.c (update_compositions, Ffind_composition_internal):
      * dired.c (directory_files_internal, file_name_completion)
      (Fsystem_users):
      * dispnew.c (Fopen_termscript, bitch_at_user, init_display):
      * doc.c (Fsnarf_documentation):
      * editfns.c (Fmessage_box):
      * emacs.c (main):
      * eval.c (do_debug_on_call, signal_error, maybe_call_debugger)
      (Feval, eval_sub, Ffuncall, apply_lambda):
      * fileio.c (make_temp_name, Fcopy_file, Faccess_file)
      (Fset_file_selinux_context, Fset_file_acl, Fset_file_modes)
      (Fset_file_times, Finsert_file_contents)
      (Fchoose_write_coding_system, Fwrite_region):
      * fns.c (Flax_plist_put, Fyes_or_no_p, syms_of_fns):
      * font.c (font_registry_charsets, font_parse_fcname)
      (font_prepare_cache, font_update_drivers, Flist_fonts):
      * fontset.c (Fset_fontset_font, Ffontset_info, syms_of_fontset):
      * frame.c (make_frame, Fmake_terminal_frame)
      (x_set_frame_parameters, x_report_frame_params)
      (x_default_parameter, Fx_parse_geometry):
      * ftfont.c (syms_of_ftfont):
      * image.c (gif_load):
      * keyboard.c (command_loop_1):
      * keymap.c (Fmake_keymap, Fmake_sparse_keymap, access_keymap_1)
      (Fcopy_keymap, append_key, Fcurrent_active_maps)
      (Fminor_mode_key_binding, accessible_keymaps_1)
      (Faccessible_keymaps, Fwhere_is_internal):
      * lread.c (read_emacs_mule_char):
      * menu.c (find_and_return_menu_selection):
      * minibuf.c (get_minibuffer):
      * nsfns.m (Fns_perform_service):
      * nsfont.m (ns_script_to_charset):
      * nsmenu.m (ns_popup_dialog):
      * nsselect.m (ns_get_local_selection, ns_string_from_pasteboard)
      (Fx_own_selection_internal):
      * nsterm.m (append2):
      * print.c (Fredirect_debugging_output)
      (print_prune_string_charset):
      * process.c (Fdelete_process, Fprocess_contact)
      (Fformat_network_address, set_socket_option)
      (read_and_dispose_of_process_output, write_queue_push)
      (send_process, exec_sentinel):
      * sound.c (Fplay_sound_internal):
      * textprop.c (validate_plist, add_properties)
      (Fput_text_property, Fadd_face_text_property)
      (copy_text_properties, text_property_list, syms_of_textprop):
      * unexaix.c (report_error):
      * unexcoff.c (report_error):
      * unexsol.c (unexec):
      * xdisp.c (redisplay_tool_bar, store_mode_line_string)
      (Fformat_mode_line, syms_of_xdisp):
      * xfaces.c (set_font_frame_param)
      (Finternal_lisp_face_attribute_values)
      (Finternal_merge_in_global_face, syms_of_xfaces):
      * xfns.c (x_default_scroll_bar_color_parameter)
      (x_default_font_parameter, x_create_tip_frame):
      * xfont.c (xfont_supported_scripts):
      * xmenu.c (Fx_popup_dialog, xmenu_show, xdialog_show)
      (menu_help_callback, xmenu_show):
      * xml.c (make_dom):
      * xterm.c (set_wm_state):
      Prefer list1 (FOO) to Fcons (FOO, Qnil) when creating a list,
      and similarly for list2 through list5.
      6c6f1994
  24. 02 Jul, 2013 1 commit
    • Paul Eggert's avatar
      Don't convert function pointers to void * and back. · 52a9bcae
      Paul Eggert authored
      It isn't portable C, and it's easy enough to avoid.
      * alloc.c: Verify SAVE_FUNCPOINTER bits, too.
      (make_save_value): Add support for SAVE_FUNCPOINTER.
      * keymap.c (map_keymap_char_table_item, map_keymap_internal):
      * print.c (print_object):
      Distinguish function from object pointers.
      * lisp.h (SAVE_FUNCPOINTER): New constant.
      (SAVE_SLOT_BITS): Adjust to it.
      (SAVE_TYPE_FUNCPTR_PTR_OBJ): New constant, replacing
      SAVE_TYPE_PTR_PTR_OBJ.  Change the only use.
      (voidfuncptr): New typedef.
      (struct Lisp_Save_Value): New member data[0].funcpointer.
      (XSAVE_FUNCPOINTER): New function.
      52a9bcae
  25. 17 Jun, 2013 1 commit
    • Paul Eggert's avatar
      Use functions, not macros, for XINT etc. · 84575e67
      Paul Eggert authored
      In lisp.h, prefer functions to function-like macros, and
      constants to object-like macros, when either will do.  This:
       . simplifies use, as there's no more need to worry about
         arguments' side effects being evaluated multiple times.
       . makes the code easier to debug on some platforms.
      However, when using gcc -O0, keep using function-like macros
      for a few critical operations, for performance reasons.
      This sort of thing isn't needed with gcc -Og, but -Og
      is a GCC 4.8 feature and isn't widely-enough available yet.
      Also, move functions from lisp.h to individual modules when possible.
      From a suggestion by Andreas Schwab in <http://bugs.gnu.org/11935#68>.
      * alloc.c (XFLOAT_INIT, set_symbol_name):
      * buffer.c (CHECK_OVERLAY):
      * chartab.c (CHECK_CHAR_TABLE, set_char_table_ascii)
      (set_char_table_parent):
      * coding.c (CHECK_NATNUM_CAR, CHECK_NATNUM_CDR):
      * data.c (BOOLFWDP, INTFWDP, KBOARD_OBJFWDP, OBJFWDP, XBOOLFWD)
      (XKBOARD_OBJFWD, XINTFWD, XOBJFWD, CHECK_SUBR, set_blv_found)
      (blv_value, set_blv_value, set_blv_where, set_blv_defcell)
      (set_blv_valcell):
      * emacs.c (setlocale) [!HAVE_SETLOCALE]:
      * eval.c (specpdl_symbol, specpdl_old_value, specpdl_where)
      (specpdl_arg, specpdl_func, backtrace_function, backtrace_nargs)
      (backtrace_args, backtrace_debug_on_exit):
      * floatfns.c (CHECK_FLOAT):
      * fns.c (CHECK_HASH_TABLE, CHECK_LIST_END)
      (set_hash_key_and_value, set_hash_next, set_hash_next_slot)
      (set_hash_hash, set_hash_hash_slot, set_hash_index)
      (set_hash_index_slot):
      * keymap.c (CHECK_VECTOR_OR_CHAR_TABLE):
      * marker.c (CHECK_MARKER):
      * textprop.c (CHECK_STRING_OR_BUFFER):
      * window.c (CHECK_WINDOW_CONFIGURATION):
      Move here from lisp.h, and make these functions static rather than
      extern inline.
      * buffer.c (Qoverlayp):
      * data.c (Qsubrp):
      * fns.c (Qhash_table_p):
      * window.c (Qwindow_configuration_p):
      Now static.
      * lisp.h: Remove the abovementioned defns and decls.
      
      * configure.ac (WARN_CFLAGS): Remove -Wbad-function-cast,
      as it generates bogus warnings about reasonable casts of calls.
      * alloc.c (gdb_make_enums_visible) [USE_LSB_TAG]:
      Remove enum lsb_bits; no longer needed.
      (allocate_misc, free_misc): Don't use XMISCTYPE as an lvalue.
      * buffer.c (Qoverlap):
      * data.c (Qsubrp):
      * fns.c (Qhash_table_p):
      Now extern, so lisp.h can use these symbols.
      * dispextern.h: Include character.h, for MAX_CHAR etc.
      (GLYPH, GLYPH_CHAR, GLYPH_FACE, SET_GLYPH_CHAR, SET_GLYPH_FACE)
      (SET_GLYPH, GLYPH_CODE_CHAR, GLYPH_CODE_FACE)
      (SET_GLYPH_FROM_GLYPH_CODE, GLYPH_MODE_LINE_FACE, GLYPH_CHAR_VALID_P)
      (GLYPH_CODE_P): Move here from lisp.h.
      (GLYPH_CHAR, GLYPH_FACE, GLYPH_CODE_CHAR, GLYPH_CODE_FACE)
      (GLYPH_CHAR_VALID_P, GLYPH_CODE_P): Now functions, not macros.
      (GLYPH_MODE_LINE_FACE): Now enums, not macros.
      * eval.c (Fautoload): Cast XUNTAG output to intptr_t, since
      XUNTAG now returns void *.
      * lisp.h (lisp_h_XLI, lisp_h_XIL, lisp_h_CHECK_LIST_CONS)
      (lisp_h_CHECK_NUMBER CHECK_SYMBOL, lisp_h_CHECK_TYPE)
      (lisp_h_CONSP, lisp_h_EQ, lisp_h_FLOATP, lisp_h_INTEGERP)
      (lisp_h_MARKERP, lisp_h_MISCP, lisp_h_NILP)
      (lisp_h_SET_SYMBOL_VAL, lisp_h_SYMBOL_CONSTANT_P)
      (lisp_h_SYMBOL_VAL, lisp_h_SYMBOLP, lisp_h_VECTORLIKEP)
      (lisp_h_XCAR, lisp_h_XCDR, lisp_h_XCONS, lisp_h_XHASH)
      (lisp_h_XPNTR, lisp_h_XSYMBOL):
      New macros, renamed from their sans-lisp_h_ counterparts.
      (XLI, XIL, CHECK_LIST_CONS, CHECK_NUMBER CHECK_SYMBOL)
      (CHECK_TYPE, CONSP, EQ, FLOATP, INTEGERP, MARKERP)
      (MISCP, NILP, SET_SYMBOL_VAL, SYMBOL_CONSTANT_P, SYMBOL_VAL, SYMBOLP)
      (VECTORLIKEP, XCAR, XCDR, XCONS, XHASH, XPNTR, XSYMBOL):
      If compiling via GCC without optimization, define these as macros
      in addition to inline functions.
      To disable this, compile with -DINLINING=0.
      (LISP_MACRO_DEFUN, LISP_MACRO_DEFUN_VOID): New macros.
      (check_cons_list) [!GC_CHECK_CONS_LIST]: Likewise.
      (make_number, XFASTINT, XINT, XTYPE, XUNTAG): Likewise, but
      hand-optimize only in the USE_LSB_TAG case, as GNUish hosts do that.
      (INTMASK, VALMASK): Now macros, since static values cannot be
      accessed from extern inline functions.
      (VALMASK): Also a constant, for benefit of old GDB.
      (LISP_INT_TAG_P): Remove; no longer needed as the only caller
      is INTEGERP, which can fold it in.
      (XLI, XIL, XHASH, XTYPE,XINT, XFASTINT, XUINT)
      (make_number, XPNTR, XUNTAG, EQ, XCONS, XVECTOR, XSTRING, XSYMBOL)
      (XFLOAT, XPROCESS, XWINDOW, XTERMINAL, XSUBR, XBUFFER, XCHAR_TABLE)
      (XSUB_CHAR_TABLE, XBOOL_VECTOR, make_lisp_ptr, CHECK_TYPE)
      (CHECK_STRING_OR_BUFFER, XCAR, XCDR, XSETCAR, XSETCDR, CAR, CDR)
      (CAR_SAFE, CDR_SAFE, STRING_MULTIBYTE, SDATA, SSDATA, SREF, SSET)
      (SCHARS, STRING_BYTES, SBYTES, STRING_SET_CHARS, STRING_COPYIN, AREF)
      (ASIZE, ASET, CHAR_TABLE_REF_ASCII, CHAR_TABLE_REF)
      (CHAR_TABLE_SET, CHAR_TABLE_EXTRA_SLOTS, SYMBOL_VAL, SYMBOL_ALIAS)
      (SYMBOL_BLV, SYMBOL_FWD, SET_SYMBOL_VAL, SET_SYMBOL_ALIAS)
      (SET_SYMBOL_BLV, SET_SYMBOL_FWD, SYMBOL_NAME, SYMBOL_INTERNED_P)
      (SYMBOL_INTERNED_IN_INITIAL_OBARRAY_P, SYMBOL_CONSTANT_P)
      (XHASH_TABLE, HASH_TABLE_P, CHECK_HASH_TABLE, HASH_KEY, HASH_VALUE)
      (HASH_NEXT, HASH_HASH, HASH_INDEX, HASH_TABLE_SIZE)
      (XMISC, XMISCANY, XMARKER, XOVERLAY, XSAVE_VALUE, XFWDTYPE)
      (XINTFWD, XBOOLFWD, XOBJFWD, XBUFFER_OBJFWD, XKBOARD_OBJFWD)
      (XFLOAT_DATA, XFLOAT_INIT, NILP, NUMBERP, NATNUMP)
      (RANGED_INTEGERP, CONSP, FLOATP, MISCP, STRINGP, SYMBOLP)
      (INTEGERP, VECTORLIKEP, VECTORP, OVERLAYP)
      (MARKERP, SAVE_VALUEP, AUTOLOADP, INTFWDP, BOOLFWDP, OBJFWDP)
      (BUFFER_OBJFWDP, KBOARD_OBJFWDP, PSEUDOVECTOR_TYPEP)
      (PSEUDOVECTORP, WINDOW_CONFIGURATIONP, PROCESSP, WINDOWP)
      (TERMINALP, SUBRP, COMPILEDP, BUFFERP, CHAR_TABLE_P)
      (SUB_CHAR_TABLE_P, BOOL_VECTOR_P, FRAMEP, IMAGEP, ARRAYP)
      (CHECK_LIST, CHECK_LIST_CONS, CHECK_LIST_END, CHECK_STRING)
      (CHECK_STRING_CAR, CHECK_CONS, CHECK_SYMBOL, CHECK_CHAR_TABLE)
      (CHECK_VECTOR, CHECK_VECTOR_OR_STRING, CHECK_ARRAY)
      (CHECK_VECTOR_OR_CHAR_TABLE, CHECK_BUFFER, CHECK_WINDOW)
      (CHECK_WINDOW_CONFIGURATION, CHECK_PROCESS, CHECK_SUBR)
      (CHECK_NUMBER, CHECK_NATNUM, CHECK_MARKER, XFLOATINT)
      (CHECK_FLOAT, CHECK_NUMBER_OR_FLOAT, CHECK_OVERLAY)
      (CHECK_NUMBER_CAR, CHECK_NUMBER_CDR, CHECK_NATNUM_CAR)
      (CHECK_NATNUM_CDR, FUNCTIONP, SPECPDL_INDEX, LOADHIST_ATTACH)
      Now functions.
      (check_cons_list) [!GC_CHECK_CONS_LIST]: New empty function.
      (LISP_MAKE_RVALUE, TYPEMASK): Remove; no longer needed.
      (VALMASK): Define in one place rather than in two, merging the
      USE_LSB_TAG parts; this is simpler.
      (aref_addr, gc_aset, MOST_POSITIVE_FIXNUM, MOST_NEGATIVE_FIXNUM)
      (max, min, struct Lisp_String, UNSIGNED_CMP, ASCII_CHAR_P):
      Move up, to avoid use before definition.
      Also include "globals.h" earlier, for the same reason.
      (make_natnum): New function.
      (XUNTAG): Now returns void *, not intptr_t, as this means fewer casts.
      (union Lisp_Fwd, BOOLFWDP, BOOL_VECTOR_P, BUFFER_OBJFWDP, BUFFERP)
      (CHAR_TABLE_P, CHAR_TABLE_REF_ASCII, CONSP, FLOATP, INTEGERP, INTFWDP)
      (KBOARD_OBJFWDP, MARKERP, MISCP, NILP, OBJFWDP, OVERLAYP, PROCESSP)
      (PSEUDOVECTORP, SAVE_VALUEP, STRINGP, SUB_CHAR_TABLE_P, SUBRP, SYMBOLP)
      (VECTORLIKEP, WINDOWP, Qoverlayp, char_table_ref, char_table_set)
      (char_table_translate, Qarrayp, Qbufferp, Qbuffer_or_string_p)
      (Qchar_table_p, Qconsp, Qfloatp, Qintegerp, Qlambda, Qlistp, Qmarkerp)
      (Qnil, Qnumberp, Qsubrp, Qstringp, Qsymbolp, Qvectorp)
      (Qvector_or_char_table_p, Qwholenump, Ffboundp, wrong_type_argument)
      (initialized, Qhash_table_p, extract_float, Qprocessp, Qwindowp)
      (Qwindow_configuration_p, Qimage): New forward declarations.
      (XSETFASTINT): Simplify by rewriting in terms of make_natnum.
      (STRING_COPYIN): Remove; unused.
      (XCAR_AS_LVALUE, XCDR_AS_LVALUE): Remove these macros, replacing with ...
      (xcar_addr, xcdr_addr): New functions.  All uses changed.
      (IEEE_FLOATING_POINT): Now a constant, not a macro.
      (GLYPH, GLYPH_CHAR, GLYPH_FACE, SET_GLYPH_CHAR, SET_GLYPH_FACE)
      (SET_GLYPH, GLYPH_CODE_CHAR, GLYPH_CODE_FACE)
      (SET_GLYPH_FROM_GLYPH_CODE, GLYPH_MODE_LINE_FACE, GLYPH_CHAR_VALID_P)
      (GLYPH_CODE_P): Move to dispextern.h, to avoid define-before-use.
      (TYPE_RANGED_INTEGERP): Simplify.
      (Qsubrp, Qhash_table_p, Qoverlayp): New extern decls.
      (setlocale, fixup_locale, synchronize_system_messages_locale)
      (synchronize_system_time_locale) [!HAVE_SETLOCALE]:
      Now empty functions, not macros.
      (functionp): Return bool, not int.
      * window.c (Qwindow_configuration_p): Now extern,
      so window.h can use it.
      * window.h (Qwindowp): Move decl back to lisp.h.
      84575e67
  26. 05 Jun, 2013 1 commit
  27. 02 Apr, 2013 1 commit
    • Paul Eggert's avatar
      Prefer < to > in range checks such as 0 <= i && i < N. · 7216e43b
      Paul Eggert authored
      This makes it easier to visualize quantities on a number line.
      This patch doesn't apply to all such range checks,
      only to the range checks affected by the 2013-03-24 change.
      This patch reverts most of the 2013-03-24 change.
      * alloc.c (xpalloc, Fgarbage_collect):
      * ccl.c (ccl_driver, resolve_symbol_ccl_program):
      * character.c (string_escape_byte8):
      * charset.c (read_hex):
      * data.c (cons_to_unsigned):
      * dispnew.c (update_frame_1):
      * doc.c (Fsubstitute_command_keys):
      * doprnt.c (doprnt):
      * editfns.c (hi_time, decode_time_components):
      * fileio.c (file_offset):
      * fns.c (larger_vector, make_hash_table, Fmake_hash_table):
      * font.c (font_intern_prop):
      * frame.c (x_set_alpha):
      * gtkutil.c (get_utf8_string):
      * indent.c (check_display_width):
      * keymap.c (Fkey_description):
      * lisp.h (FIXNUM_OVERFLOW_P, vcopy):
      * lread.c (read1):
      * minibuf.c (read_minibuf_noninteractive):
      * process.c (wait_reading_process_output):
      * search.c (Freplace_match):
      * window.c (get_phys_cursor_glyph):
      * xdisp.c (redisplay_internal):
      * xsmfns.c (smc_save_yourself_CB):
      Prefer < to > for range checks.
      * dispnew.c (sit_for): Don't mishandle NaNs.
      This fixes a bug introduced in the 2013-03-24 change.
      * editfns.c (decode_time_components): Don't hoist comparison.
      This fixes another bug introduced in the 2013-03-24 change.
      7216e43b
  28. 28 Mar, 2013 1 commit
    • Dmitry Antipov's avatar
      * window.h (struct window): Replace hchild, vchild and buffer slots · e74aeda8
      Dmitry Antipov authored
      with the only contents slot.  This is possible because each valid
      window may have either the child window (in vertical or horizontal
      combination) or buffer to display (for the leaf window).  Using that,
      a lof of operations to traverse and/or change window hierarchies may
      be simplified.  New member horizontal is used to distinguish between
      horizontal and vertical combinations of internal windows.
      (WINDOW_LEAF_P, WINDOW_HORIZONTAL_COMBINATION_P)
      (WINDOW_VERTICAL_COMBINATION_P): New macros.
      (WINDOW_VALID_P, WINDOW_LIVE_P): Adjust to match struct window changes.
      * window.c (wset_hchild, wset_vchild): Remove.  Adjust all users.
      Use contents slot, not buffer, where appropriate.
      (wset_combination): New function.
      (wset_buffer): Add eassert.
      (Fframe_first_window): Simplify the loop reaching first window.
      (Fwindow_buffer): Use WINDOW_LEAF_P.
      (Fwindow_top_child): Use WINDOW_VERTICAL_COMBINATION_P.
      (Fwindow_left_child): Use WINDOW_HORIZONTAL_COMBINATION_P.
      (unshow_buffer): Convert initial debugging check to eassert.
      (replace_window, recombine_windows, Fdelete_other_windows_internal)
      (make_parent_window, window_resize_check, window_resize_apply)
      (resize_frame_windows, Fsplit_window_internal, Fdelete_window_internal)
      (Fset_window_configuration, delete_all_child_windows, save_window_save):
      Adjust to match struct window changes.
      (window_loop): Check for broken markers in CHECK_ALL_WINDOWS.
      (mark_window_cursors_off, count_windows, get_leaf_windows)
      (foreach_window_1): Simplify the loop.
      * alloc.c (mark_object): Do not check for the leaf window because
      internal windows has no glyph matrices anyway.
      * dispnew.c (clear_window_matrices, showing_window_margins_p)
      (allocate_matrices_for_window_redisplay, fake_current_matrices)
      (allocate_matrices_for_frame_redisplay, free_window_matrices)
      (build_frame_matrix_from_window_tree, mirror_make_current)
      (frame_row_to_window, mirror_line_dance, check_window_matrix_pointers)
      (update_window_tree, set_window_update_flags): Simplify the loop.
      (sync_window_with_frame_matrix_rows): Enforce live window.
      Use contents slot, not buffer, where appropriate.
      * frame.c (set_menu_bar_lines_1): Use WINDOW_VERTICAL_COMBINATION_P
      and WINDOW_HORIZONTAL_COMBINATION_P.
      (make_frame_visible_1): Simplify the loop.
      Use contents slot, not buffer, where appropriate.
      * xdisp.c (hscroll_window_tree, mark_window_display_accurate)
      (redisplay_windows, redisplay_mode_lines, update_cursor_in_window_tree)
      (expose_window_tree): Likewise.
      Use contents slot, not buffer, where appropriate.
      * textprop.c (get_char_property_and_overlay): Add CHECK_LIVE_WINDOW
      to avoid deleted windows.  Use contents slot instead of buffer.
      * buffer.c, dispextern.h, editfns.c, fileio.c, font.c, fringe.c:
      * indent.c, insdel.c, keyboard.c, keymap.c, minibuf.c, msdos.c:
      * nsfns.m, nsmenu.m, nsterm.m, print.c, w32fns.c, w32menu.c, xfaces.c:
      * xfns.c, xmenu.c: Use contents slot, not buffer, where appropriate.
      e74aeda8
  29. 24 Mar, 2013 1 commit
    • Andreas Schwab's avatar
      Reorder conditions that are written backwards · 908589fd
      Andreas Schwab authored
      * alloc.c (xpalloc, Fgarbage_collect): Reorder conditions that are
      written backwards.
      * blockinput.h (input_blocked_p): Likewise.
      * bytecode.c (exec_byte_code): Likewise.
      * callproc.c (call_process_kill, call_process_cleanup)
      (Fcall_process): Likewise.
      * ccl.c (ccl_driver, resolve_symbol_ccl_program)
      (Fccl_execute_on_string): Likewise.
      * character.c (string_escape_byte8): Likewise.
      * charset.c (read_hex): Likewise.
      * cm.c (calccost): Likewise.
      * data.c (cons_to_unsigned): Likewise.
      * dired.c (directory_files_internal, file_name_completion):
      Likewise.
      * dispnew.c (scrolling_window, update_frame_1, Fsleep_for)
      (sit_for): Likewise.
      * doc.c (Fsubstitute_command_keys): Likewise.
      * doprnt.c (doprnt): Likewise.
      * editfns.c (hi_time, decode_time_components, Fformat): Likewise.
      * emacsgtkfixed.c: Likewise.
      * fileio.c (file_offset, Fwrite_region): Likewise.
      * floatfns.c (Fexpt, fmod_float): Likewise.
      * fns.c (larger_vector, make_hash_table, Fmake_hash_table):
      Likewise.
      * font.c (font_intern_prop): Likewise.
      * frame.c (x_set_alpha): Likewise.
      * gtkutil.c (get_utf8_string): Likewise.
      * indent.c (check_display_width): Likewise.
      * intervals.c (create_root_interval, rotate_right, rotate_left)
      (split_interval_right, split_interval_left)
      (adjust_intervals_for_insertion, delete_node)
      (interval_deletion_adjustment, adjust_intervals_for_deletion)
      (merge_interval_right, merge_interval_left, copy_intervals)
      (set_intervals_multibyte_1): Likewise.
      * keyboard.c (gobble_input, append_tool_bar_item): Likewise.
      * keymap.c (Fkey_description): Likewise.
      * lisp.h (FIXNUM_OVERFLOW_P, vcopy): Likewise.
      * lread.c (openp, read_integer, read1, string_to_number):
      Likewise.
      * menu.c (ensure_menu_items): Likewise.
      * minibuf.c (read_minibuf_noninteractive): Likewise.
      * print.c (printchar, strout): Likewise.
      * process.c (create_process, Faccept_process_output)
      (wait_reading_process_output, read_process_output, send_process)
      (wait_reading_process_output): Likewise.
      * profiler.c (make_log, handle_profiler_signal): Likewise.
      * regex.c (re_exec): Likewise.
      * regex.h: Likewise.
      * search.c (looking_at_1, Freplace_match): Likewise.
      * sysdep.c (get_child_status, procfs_ttyname)
      (procfs_get_total_memory): Likewise.
      * systime.h (EMACS_TIME_VALID_P): Likewise.
      * term.c (dissociate_if_controlling_tty): Likewise.
      * window.c (get_phys_cursor_glyph): Likewise.
      * xdisp.c (init_iterator, redisplay_internal, redisplay_window)
      (try_window_reusing_current_matrix, try_window_id, pint2hrstr):
      Likewise.
      * xfns.c (Fx_window_property): Likewise.
      * xmenu.c (set_frame_menubar): Likewise.
      * xselect.c (x_get_window_property, x_handle_dnd_message):
      Likewise.
      * xsmfns.c (smc_save_yourself_CB): Likewise.
      * xterm.c (x_scroll_bar_set_handle): Likewise.
      908589fd
  30. 21 Mar, 2013 1 commit
    • Paul Eggert's avatar
      Use functions and constants to manipulate Lisp_Save_Value objects. · 7b1123d8
      Paul Eggert authored
      This replaces code that used macros and strings and token-pasting.
      The change makes the C source a bit easier to follow,
      and shrinks the Emacs executable a bit.
      * alloc.c: Verify some properties of Lisp_Save_Value's representation.
      (make_save_value): Change 1st arg from string to enum.  All callers
      changed.
      (INTX): Remove.
      (mark_object): Use if, not #if, for GC_MARK_STACK.
      * lisp.h (SAVE_VALUEP, XSAVE_VALUE, XSAVE_POINTER, XSAVE_INTEGER)
      (XSAVE_OBJECT): Now functions, not macros.
      (STRING_BYTES_BOUND): Now just a macro, not a constant too;
      the constant was never used.
      (SAVE_SLOT_BITS, SAVE_VALUE_SLOTS, SAVE_TYPE_BITS, SAVE_TYPE_INT_INT)
      (SAVE_TYPE_INT_INT_INT, SAVE_TYPE_OBJ_OBJ, SAVE_TYPE_OBJ_OBJ_OBJ)
      (SAVE_TYPE_OBJ_OBJ_OBJ_OBJ, SAVE_TYPE_PTR_INT, SAVE_TYPE_PTR_OBJ)
      (SAVE_TYPE_PTR_PTR, SAVE_TYPE_PTR_PTR_OBJ, SAVE_TYPE_MEMORY):
      New constants.
      (struct Lisp_Save_Value): Replace members area, type0, type1, type2,
      type3 with a single member save_type.  All uses changed.
      (save_type, set_save_pointer, set_save_integer): New functions.
      * print.c (PRINTX): Remove.
      7b1123d8
  31. 13 Mar, 2013 1 commit
    • Paul Eggert's avatar
      Static checking by Sun C 5.12. · d9df6f40
      Paul Eggert authored
      * lib-src/etags.c (analyse_regex): Omit unreachable code.
      * src/alloc.c (buffer_memory_full) [REL_ALLOC]:
      * src/bytecode.c (exec_byte_code):
      * src/dispnew.c (init_display):
      * src/eval.c (error):
      * src/fileio.c (Fsubstitute_in_file_name):
      * src/keyboard.c (Fevent_convert_list):
      * src/keymap.c (Fsingle_key_description):
      * src/term.c (maybe_fatal, fatal):
      * src/xfns.c (Fx_display_backing_store, Fx_display_visual_class):
      * src/xsmfns.c (Fhandle_save_session):
      Omit unreachable code.
      * src/keymap.c (map_keymap_char_table_item): Cast void * to
      a function pointer type; the C Standard requires this.
      d9df6f40
  32. 11 Feb, 2013 1 commit
    • Stefan Monnier's avatar
      Clean up read_key_sequence a bit; reread active keymaps after first event. · 99d0d6dc
      Stefan Monnier authored
      * src/keyboard.c (read_char, read_char_x_menu_prompt)
      (read_char_minibuf_menu_prompt):
      Replace nmaps+maps with a single `map' arg.
      (follow_key): Operate on a single map.
      (active_maps): New function.
      (test_undefined): Also return true for nil bindings.
      (read_key_sequence): Use active_maps to replace the arrays of keymaps with
      a single (composed) keymap.  Remember `first_event' to choose the right
      set of active keymaps.  Recompute the set of keymaps after receiving
      the first event.  Remove GOBBLE_FIRST_EVENT.
      (syms_of_keyboard): Remove inhibit_local_menu_bar_menus.
      * src/keyboard.h (read_char): Update declaration.
      * src/lread.c (read_filtered_event): Adjust call to read_char.
      * lisp/cus-start.el (all): Remove inhibit-local-menu-bar-menus.
      99d0d6dc
  33. 17 Jan, 2013 1 commit
    • Dmitry Antipov's avatar
      * lisp.h (toplevel): Add comment about using Lisp_Save_Value · 468afbac
      Dmitry Antipov authored
      objects, related functions and macros.
      (make_save_value): Adjust prototype.
      (make_save_pointer): New prototype.
      (SAFE_NALLOCA): Fix indentation.  Use make_save_pointer.
      (SAFE_ALLOCA_LISP): Adjust make_save_value usage.
      * alloc.c (format_save_value): Rename to make_save_value.
      (make_save_pointer): New function.
      (record_xmalloc): Use make_save_pointer.
      * dired.c, editfns.c, fileio.c, font.c, gtkutil.c, lread.c:
      * nsmenu.m, nsterm.m, xfns.c, xmenu.c, xselect.c, keymap.c:
      Change users of make_save_value to make_save_pointer.
      Likewise for format_save_value and make_save_value.
      468afbac
  34. 15 Jan, 2013 2 commits
    • Dmitry Antipov's avatar
      * keymap.c (map_keymap_internal): Use format_save_value. · 3346c1d0
      Dmitry Antipov authored
      (map_keymap_char_table_item): Adjust accordingly.
      * fileio.c (non_regular_fd, non_regular_inserted)
      (non_regular_nbytes): Remove.
      (Finsert_file_contents): Convert trytry to ptrdiff_t.  Use
      format_save_value to pass parameters to read_non_regular.
      (read_non_regular): Use XSAVE_ macros to extract parameters.
      Adjust comment.
      * xmenu.c (xmenu_show) [!USE_X_TOOLKIT && !USE_GTK]: Use
      format_save_value.
      (pop_down_menu) [!USE_X_TOOLKIT && !USE_GTK]: Adjust user.
      3346c1d0
    • Dmitry Antipov's avatar
      * src/lisp.h (XSAVE_POINTER, XSAVE_INTEGER): Change to allow extraction · 2b30549c
      Dmitry Antipov authored
      from any Lisp_Save_Value slot.  Add type checking.
      * src/alloc.c, src/dired.c, src/editfns.c, src/fileio.c, src/ftfont.c:
      * src/gtkutil.c, src/keymap.c, src/lread.c, src/nsterm.h, src/nsmenu.c:
      * src/xfns.c, src/xmenu.c, src/xselect.c: All users changed.
      * admin/coccinelle/xsave.cocci: Semantic patch to adjust users of
      XSAVE_POINTER and XSAVE_INTEGER macros.
      2b30549c
  35. 14 Jan, 2013 2 commits
    • Paul Eggert's avatar
      Avoid needless casts with XSAVE_POINTER. · c50cf2ea
      Paul Eggert authored
      * alloc.c (mark_object) [GC_MARK_STACK]:
      * dired.c (directory_files_internal_unwind):
      * fileio.c (do_auto_save_unwind):
      * gtkutil.c (pop_down_dialog):
      * keymap.c (map_keymap_char_table_item):
      * lread.c (load_unwind):
      * nsmenu.m (pop_down_menu):
      * print.c (print_object) [GC_MARK_STACK]:
      * xfns.c (clean_up_file_dialog):
      * xmenu.c (cleanup_widget_value_tree):
      Omit casts between XSAVE_POINTER and a pointer type.
      c50cf2ea
    • Dmitry Antipov's avatar
      Make Lisp_Save_Value more versatile storage for up to four objects. · 73ebd38f
      Dmitry Antipov authored
      * lisp.h (toplevel): Enumeration to describe types of saved objects.
      (struct Lisp_Save_Value): New layout.  Adjust comments.
      (XSAVE_POINTER): New macro.
      (XSAVE_INTEGER): Likewise.
      (allocate_misc): Add prototype.
      (free_misc): Likewise.
      * alloc.c (allocate_misc): Now global.
      (free_misc): Likewise.  Adjust comment.
      (make_save_value): Use new Lisp_Save_Value layout.  Adjust comment.
      (free_save_value): Likewise.
      (mark_object): Likewise.
      * editfns.c (save_excursion_save): Pack everything within
      Lisp_Save_Value and so avoid xmalloc.
      (save_excursion_restore): Adjust to match new layout.  Use free_misc
      because we do not allocate extra memory any more.  Add eassert.
      * print.c (print_object): New code to print Lisp_Save_Value.  Do not
      rely on valid_lisp_object_p if !GC_MARK_STACK.  Adjust comments.
      * dired.c, fileio.c, font.c, ftfont.c, gtkutil.c, keymap.c,
      * lread.c, nsmenu.m, nsterm.h, xfns.c, xmenu.c, xselect.c:
      Use XSAVE_POINTER and XSAVE_INTEGER where appropriate.
      73ebd38f
  36. 01 Jan, 2013 1 commit
  37. 31 Dec, 2012 1 commit