1. 19 Apr, 2011 1 commit
    • Paul Eggert's avatar
      Replace pEd with more-general pI, and fix some printf arg casts. · c2982e87
      Paul Eggert authored
      * lisp.h (pI): New macro, generalizing old pEd macro to other
      conversion specifiers.  For example, use "...%"pI"d..." rather
      than "...%"pEd"...".
      (pEd): Remove.  All uses replaced with similar uses of pI.
      * src/m/amdx86-64.h, src/m/ia64.h, src/m/ibms390x.h: Likewise.
      * alloc.c (check_pure_size): Don't overflow by converting size to int.
      * bidi.c (bidi_dump_cached_states): Use pI to avoid cast.
      * data.c (Fnumber_to_string): Use pI instead of if-then-else-abort.
      * dbusbind.c (xd_append_arg): Use pI to avoid cast.
      (Fdbus_method_return_internal, Fdbus_method_error_internal): Likewise.
      * font.c (font_unparse_xlfd): Avoid potential buffer overrun on
      64-bit hosts.
      (font_unparse_xlfd, font_unparse_fcname): Use pI to avoid casts.
      * keyboard.c (record_char, modify_event_symbol): Use pI to avoid casts.
      * print.c (safe_debug_print, print_object): Likewise.
      (print_object): Don't overflow by converting EMACS_INT or EMACS_UINT
      to int.
      Use pI instead of if-then-else-abort.  Use %p to avoid casts.
      * process.c (Fmake_network_process): Use pI to avoid cast.
      * region-cache.c (pp_cache): Likewise.
      * xdisp.c (decode_mode_spec): Likewise.
      * xrdb.c (x_load_resources) [USE_MOTIF]: Use pI to avoid undefined
      behavior on 64-bit hosts with printf arg.
      * xselect.c (x_queue_event): Use %p to avoid casts.
      (x_stop_queuing_selection_requests): Likewise.
      (x_get_window_property): Don't truncate byte count to an 'int'
      when tracing.
  2. 15 Apr, 2011 2 commits
  3. 14 Apr, 2011 12 commits
  4. 13 Apr, 2011 5 commits
    • Paul Eggert's avatar
      * frame.c: Make symbols static if they're not exported. · 81626931
      Paul Eggert authored
      (x_report_frame_params, make_terminal_frame): Now static.
      (get_frame_param): Now static, unless HAVE_NS.
      (x_fullscreen_adjust): Define if WINDOWSNT, not if HAVE_WINDOW_SYSTEM.
      (x_get_resource_string): Remove; not used.
      * frame.h (make_terminal_frame, x_report_frame_params):
      (x_get_resource_string); Remove decls.
      (x_fullscreen_adjust): Declare only if WINDOWSNT.
      * lisp.h (get_frame_param): Declare only if HAVE_NS.
    • Paul Eggert's avatar
      * eval.c: Make symbols static if they're not exported. · 57a96f5c
      Paul Eggert authored
      (backtrace_list, lisp_eval_depth, when_entered_debugger): Now static.
      * lisp.h (backtrace_list): Remove decl.
    • Paul Eggert's avatar
      * emacs.c: Make symbols static if they're not exported. · 35f08c38
      Paul Eggert authored
      (malloc_state_ptr, malloc_using_checking, syms_of_emacs):
      (fatal_error_code, fatal_error_signal_hook, standard_args):
      Now static.
      (fatal_error_signal): Now static, unless FLOAT_CATCH_SIGKILL.
      (DEFINE_DUMMY_FUNCTION): Mark function as externally visible.
      (__CTOR_LIST__, __DTOR_LIST__): Now externally visible.
      * lisp.h (fatal_error_signal_hook): Remove decl.
      (fatal_error_signal): Declare only if FLOAT_CATCH_SIGKILL.
    • Paul Eggert's avatar
      * editfns.c: Move a (normally-unused) function to its only use. · f44bd759
      Paul Eggert authored
      * editfns.c, lisp.h (get_operating_system_release): Remove.
      * process.c (init_process) [DARWIN_OS]: Do it inline, as it is not
      worth the hassle of breaking this out.
    • Paul Eggert's avatar
      emacs_write: Return size_t, not ssize_t, to avoid overflow issues. · 273a5f82
      Paul Eggert authored
      * gnutls.c, gnutls.h (emacs_gnutls_write): Return size_t, not ssize_t.
      * sysdep.c, lisp.h (emacs_write): Likewise.
      Without the above change, emacs_gnutls_write and emacs_write had
      undefined behavior and would typically mistakenly report an error
      when writing a buffer whose size exceeds SSIZE_MAX.
      (emacs_read, emacs_write): Remove check for negative size, as the
      Emacs source code has been audited now.
      (emacs_write): Adjust to new signature, making the code look more
      like that of emacs_gnutls_write.
      * process.c (send_process): Adjust to the new signatures of
      emacs_write and emacs_gnutls_write.  Do not attempt to store
      a byte offset into an 'int'; it might overflow.
  5. 12 Apr, 2011 3 commits
    • Paul Eggert's avatar
      * sysdep.c (emacs_read, emacs_write): Check for negative sizes · 28272684
      Paul Eggert authored
      since callers should never pass a negative size.
      Change the signature to match that of plain 'read' and 'write'; see
      * lisp.h: Update prototypes of emacs_write and emacs_read.
    • Paul Eggert's avatar
      * xdisp.c: Make symbols static if they're not exported. · 8524aef3
      Paul Eggert authored
      * dispextern.h (scratch_glyph_row, window_box_edges):
      (glyph_to_pixel_coords, set_cursor_from_row):
      (get_next_display_element, set_iterator_to_next):
      (highlight_trailing_whitespace, frame_to_window_pixel_xy):
      (show_mouse_face): Remove decls
      * frame.h (message_buf_print): Likewise.
      * lisp.h (pop_message, set_message, check_point_in_composition):
      * xterm.h (set_vertical_scroll_bar): Likewise.
      * xdisp.c (list_of_error, Vmessage_stack, line_number_displayed):
      (message_buf_print, scratch_glyph_row, displayed_buffer):
      (set_iterator_to_next, pop_message, set_message, set_cursor_from_row):
      (get_next_display_element, show_mouse_face, window_box_edges):
      (frame_to_window_pixel_xy, check_point_in_composition):
      (set_vertical_scroll_bar, highlight_trailing_whitespace): Now static.
      (glyph_to_pixel_coords): Remove; unused.
    • Paul Eggert's avatar
      * lisp.h (circular_list_error, FOREACH): Remove; unused. · a25f4dfa
      Paul Eggert authored
      * data.c (circular_list_error): Remove.
  6. 11 Apr, 2011 5 commits
    • Paul Eggert's avatar
      * casetab.c (Vascii_upcase_table, Vascii_eqv_table): Now static. · 31cd66f3
      Paul Eggert authored
      * lisp.h: Remove these decls.
    • Paul Eggert's avatar
      alloc.c: Import and export fewer symbols, and remove unused items. · 244ed907
      Paul Eggert authored
      * lisp.h (suppress_checking, die): Declare only if ENABLE_CHECKING
      is defined.
      (suppress_checking): Add EXTERNALLY_VISIBLE attribute, so that
      it's not optimized away by whole-program optimization.
      (message_enable_multibyte, free_misc): Remove.
      (catchlist, handlerlist, mark_backtrace):
      Declare only if BYTE_MARK_STACK.
      (mark_byte_stack): Likewise, fixing a ifdef-vs-if typo.
      * alloc.c (pure): Export only if VIRT_ADDR_VARIES is defined.
      (message_enable_multibyte): Remove decl.
      (free_misc, interval_free_list, float_block, float_block_index):
      (n_float_blocks, float_free_list, cons_block, cons_block_index):
      (cons_free_list, last_marked_index):
      Now static.
      (suppress_checking, die): Define only if ENABLE_CHECKING is defined.
      * eval.c (catchlist, handlerlist): Export only if BYTE_MARK_STACK.
      (mark_backtrace): Define only if BYTE_MARK_STACK.
      * xdisp.c (message_enable_multibyte): Now static.
    • Paul Eggert's avatar
      Declare Lisp_Object Q* variables to be 'static' if not exproted. · 955cbe7b
      Paul Eggert authored
      This makes it easier for human readers (and static analyzers)
      to see whether these variables are used from other modules.
      * alloc.c, buffer.c, bytecode.c, callint.c, casetab.c, category.c:
      * ccl.c, character.c, charset.c, cmds.c, coding.c, composite.c:
      * data.c, dbusbind.c, dired.c, editfns.c, eval.c, fileio.c, fns.c:
      * font.c, frame.c, fringe.c, ftfont.c, image.c, keyboard.c, keymap.c:
      * lread.c, macros.c, minibuf.c, print.c, process.c, search.c:
      * sound.c, syntax.c, textprop.c, window.c, xdisp.c, xfaces.c, xfns.c:
      * xmenu.c, xselect.c:
      Declare Q* vars static if they are not used in other modules.
      * ccl.h, character.h, charset.h, coding.h, composite.h, font.h:
      * frame.h, intervals.h, keyboard.h, lisp.h, process.h, syntax.h:
      Remove decls of unexported vars.
      * keyboard.h (EVENT_HEAD_UNMODIFIED): Remove now-unused macro.
    • Paul Eggert's avatar
      * lisp.h (DEFINE_FUNC): Make sname 'static'. · 95c82688
      Paul Eggert authored
    • Paul Eggert's avatar
      Make Emacs functions such as Fatom 'static' by default. · 16a97296
      Paul Eggert authored
      This makes it easier for human readers (and static analyzers)
      to see whether these functions can be called from other modules.
      DEFUN now defines a static function.  To make the function external
      so that it can be used in other C modules, use the new macro DEFUE.
      * lisp.h (DEFINE_FUNC): New macro, with the old contents of DEFUN.
      (DEFUN): Rewrite in terms of DEFINE_FUNC.  It now generates a
      static function definition.  Use DEFUE if you want an extern one.
      (DEFUE, INFUN): New macros.
      (Funibyte_char_to_multibyte, Fsyntax_table_p, Finit_image_library):
      (Feval_region, Fbacktrace, Ffetch_bytecode, Fswitch_to_buffer):
      (Ffile_executable_p, Fmake_symbolic_link, Fcommand_execute):
      (Fget_process, Fdocumentation_property, Fbyte_code, Ffile_attributes):
      Remove decls, since these functions are now static.
      (Funintern, Fget_internal_run_time): New decls, since these functions
      were already external.
      * alloc.c, buffer.c, callint.c, callproc.c, casefiddle.c, casetab.c:
      * ccl.c, character.c, chartab.c, cmds.c, coding.c, data.c, dispnew.c:
      * doc.c, editfns.c, emacs.c, eval.c, fileio.c, filelock.c, floatfns.c:
      * fns.c, font.c, fontset.c, frame.c, image.c, indent.c:
      * keyboard.c, keymap.c, lread.c:
      * macros.c, marker.c, menu.c, minibuf.c, print.c, process.c, search.c:
      * syntax.c, term.c, terminal.c, textprop.c, undo.c:
      * window.c, xdisp.c, xfaces.c, xfns.c, xmenu.c, xsettings.c:
      Mark functions with DEFUE instead of DEFUN,
      if they are used in other modules.
      * buffer.c (Fset_buffer_major_mode, Fdelete_overlay): New forward
      decls for now-static functions.
      * buffer.h (Fdelete_overlay): Remove decl.
      * callproc.c (Fgetenv_internal): Mark as internal.
      * composite.c (Fremove_list_of_text_properties): Remove decl.
      (Fcomposition_get_gstring): New forward static decl.
      * composite.h (Fcomposite_get_gstring): Remove decl.
      * dired.c (Ffile_attributes): New forward static decl.
      * doc.c (Fdocumntation_property): New forward static decl.
      * eval.c (Ffetch_bytecode): New forward static decl.
      (Funintern): Remove extern decl; now in .h file where it belongs.
      * fileio.c (Fmake_symbolic_link): New forward static decl.
      * image.c (Finit_image_library): New forward static decl.
      * insdel.c (Fcombine_after_change_execute): Make forward decl static.
      * intervals.h (Fprevious_property_change):
      (Fremove_list_of_text_properties): Remove decls.
      * keyboard.c (Fthis_command_keys): Remove decl.
      (Fcommand_execute): New forward static decl.
      * keymap.c (Flookup_key): New forward static decl.
      (Fcopy_keymap): Now static.
      * keymap.h (Flookup_key): Remove decl.
      * process.c (Fget_process): New forward static decl.
      (Fprocess_datagram_address): Mark as internal.
      * syntax.c (Fsyntax_table_p): New forward static decl.
      (skip_chars): Remove duplicate decl.
      * textprop.c (Fprevious_property_change): New forward static decl.
      * window.c (Fset_window_fringes, Fset_window_scroll_bars):
      Now internal.
      (Fset_window_margins, Fset_window_vscroll): New forward static decls.
      * window.h (Fset_window_vscroll, Fset_window_margins): Remove decls.
  7. 10 Apr, 2011 1 commit
    • Eli Zaretskii's avatar
      Fix write-region and its subroutines for buffers > 2GB. · 8a2cbd72
      Eli Zaretskii authored
       src/fileio.c (a_write, e_write): Modify declaration of arguments and
       local variables to support buffers larger than 2GB.
       (Fcopy_file): Use EMACS_INT for return value of emacs_read.
       src/sysdep.c (emacs_write, emacs_read): Use ssize_t for last
       argument, local variables, and return value.
       src/lisp.h: Update prototypes of emacs_write and emacs_read.
       src/sound.c (vox_write): Use ssize_t for return value of emacs_write.
  8. 09 Apr, 2011 1 commit
    • Eli Zaretskii's avatar
      Replace some uses of `int' with EMACS_INT. · a53e2e89
      Eli Zaretskii authored
       src/search.c (string_match_1, fast_string_match)
       (fast_c_string_match_ignore_case, fast_string_match_ignore_case)
       (scan_buffer, find_next_newline_no_quit)
       (find_before_next_newline, search_command, Freplace_match)
       (Fmatch_data): Make some `int' variables be EMACS_INT.
       src/xdisp.c (display_count_lines): 3rd argument and return value now
       EMACS_INT.  All callers changed.
       (pint2hrstr): Last argument is now EMACS_INT.
       src/coding.c (detect_coding_utf_8, detect_coding_emacs_mule)
       (detect_coding_iso_2022, detect_coding_sjis, detect_coding_big5)
       (detect_coding_ccl, detect_coding_charset, decode_coding_utf_8)
       (decode_coding_utf_16, decode_coding_emacs_mule)
       (decode_coding_iso_2022, decode_coding_sjis, decode_coding_big5)
       (decode_coding_ccl, decode_coding_charset)
       <consumed_chars, consumed_chars_base>: Declare EMACS_INT.
       (decode_coding_iso_2022, decode_coding_emacs_mule)
       (decode_coding_sjis, decode_coding_big5, decode_coding_charset)
       <char_offset, last_offset>: Declare EMACS_INT.
       (encode_coding_utf_8, encode_coding_utf_16)
       (encode_coding_emacs_mule, encode_invocation_designation)
       (encode_designation_at_bol, encode_coding_iso_2022)
       (encode_coding_sjis, encode_coding_big5, encode_coding_ccl)
       (encode_coding_raw_text, encode_coding_charset) <produced_chars>:
       Declare EMACS_INT.
       (ASSURE_DESTINATION): Declare more_bytes EMACS_INT.
       (encode_invocation_designation): Last argument P_NCHARS is now
       (decode_eol): Declare pos_byte, pos, and pos_end EMACS_INT.
       (produce_chars): from_nchars and to_nchars are now EMACS_INT.
       src/coding.h (struct coding_system) <head_ascii>: Declare EMACS_INT.
       All users changed.
       src/ccl.c (Fccl_execute_on_string): Declare some variables
  9. 08 Apr, 2011 1 commit
    • Chong Yidong's avatar
      Remove internal_with_output_to_temp_buffer, replacing sole user with Lisp. · cbb59342
      Chong Yidong authored
      * lisp/help.el (help-form-show): New function, to be called from C.
      Put help-form output in a buffer named differently than *Help*.
      * src/keyboard.c (read_char): Call Lisp function help-form-show,
      instead of using internal_with_output_to_temp_buffer.
      (Qhelp_form_show): New var.
      * src/lisp.h (internal_with_output_to_temp_buffer): Remove prototype.
      * src/print.c (internal_with_output_to_temp_buffer): Function deleted.
  10. 07 Apr, 2011 2 commits
    • Paul Eggert's avatar
    • Paul Eggert's avatar
      error: Print 32- and 64-bit integers portably (Bug#8435). · 5fdb398c
      Paul Eggert authored
      Without this change, on typical 64-bit hosts error ("...%d...", N)
      was used to print both 32- and 64-bit integers N, which relied on
      undefined behavior.
      * lisp.h, src/m/amdx86-64.h, src/m/ia64.h, src/m/ibms390x.h (pEd):
      New macro.
      * lisp.h (error, verror): Mark as printf-like functions.
      * eval.c (verror): Use vsnprintf, not doprnt, to do the real work.
      Report overflow in size calculations when allocating printf buffer.
      Do not truncate output string at its first null byte.
      * xdisp.c (vmessage): Use vsnprintf, not doprnt, to do the real work.
      Truncate the output at a character boundary, since vsnprintf does not
      do that.
      * charset.c (check_iso_charset_parameter): Convert internal
      character to string before calling 'error', since %c now has the
      printf meaning.
      * coding.c (Fdecode_sjis_char, Fdecode_big5_char): Avoid int
      overflow when computing char to be passed to 'error'.  Do not
      pass Lisp_Object to 'error'; pass the integer instead.
      * nsfns.m (Fns_do_applescript): Use int, not long, since it's
      formatted with plain %d.
  11. 06 Apr, 2011 2 commits
  12. 05 Apr, 2011 1 commit
  13. 01 Apr, 2011 2 commits
  14. 28 Mar, 2011 2 commits
    • Juanma Barranquero's avatar
      src/*.c: Remove some additional unused parameters. · 461c2ab9
      Juanma Barranquero authored
      * lisp.h (multibyte_char_to_unibyte):
      * character.c (multibyte_char_to_unibyte): Remove parameter `rev_tbl',
        unused since 2002-03-01T01:16:34Z!handa@m17n.org and 2008-02-01T16:01:31Z!miles@gnu.org.
      * character.h (CHAR_TO_BYTE8):
      * cmds.c (internal_self_insert):
      * editfns.c (general_insert_function):
      * keymap.c (push_key_description):
      * search.c (Freplace_match):
      * xdisp.c (message_dolog, set_message_1): All callers changed.
      * coding.c (encode_designation_at_bol): Remove parameter `charbuf_end',
        unused since 2002-03-01T01:17:24Z!handa@m17n.org and 2008-02-01T16:01:31Z!miles@gnu.org.
        All callers changed.
    • Stefan Monnier's avatar
      Don't reset post-command-hook to nil upon error. · f6d62986
      Stefan Monnier authored
      * src/eval.c (enum run_hooks_condition): Remove.
      (funcall_nil, funcall_not): New functions.
      (run_hook_with_args): Call each function through a `funcall' argument.
      Remove `cond' argument, now redundant.
      (Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success)
      (Frun_hook_with_args_until_failure): Adjust accordingly.
      (run_hook_wrapped_funcall, Frun_hook_wrapped): New functions.
      * src/keyboard.c (safe_run_hook_funcall): New function.
      (safe_run_hooks_1, safe_run_hooks_error, safe_run_hooks): On error,
      don't set the hook to nil, but remove the offending function instead.
      (Qcommand_hook_internal): Remove, unused.
      (syms_of_keyboard): Don't initialize Qcommand_hook_internal nor define
      * doc/lispref/commands.texi (Command Overview): post-command-hook is not reset
      to nil any more.