1. 19 Jul, 2011 1 commit
    • Paul Eggert's avatar
      Use ptrdiff_t for hash table indexes. · d3411f89
      Paul Eggert authored
      * category.c (hash_get_category_set):
      * ccl.c (ccl_driver):
      * charset.h (struct charset.hash_index, CHECK_CHARSET_GET_ID):
      * coding.c (coding_system_charset_list, detect_coding_system):
      * coding.h (struct coding_system.id):
      * composite.c (get_composition_id, gstring_lookup_cache):
      * fns.c (hash_lookup, hash_put, Fgethash, Fputhash):
      * image.c (xpm_get_color_table_h):
      * lisp.h (hash_lookup, hash_put):
      * minibuf.c (Ftest_completion):
      Use ptrdiff_t for hash table indexes, not int (which is too
      narrow, on 64-bit hosts) or EMACS_INT (which is too wide, on
      32-bit --with-wide-int hosts).
      d3411f89
  2. 01 Jul, 2011 1 commit
  3. 19 Jun, 2011 1 commit
  4. 14 Jun, 2011 1 commit
    • Paul Eggert's avatar
      Variadic C functions now count arguments with ptrdiff_t. · f66c7cf8
      Paul Eggert authored
      This partly undoes my 2011-03-30 change, which replaced int with size_t.
      Back then I didn't know that the Emacs coding style prefers signed int.
      Also, in the meantime I found a few more instances where arguments
      were being counted with int, which may truncate counts on 64-bit
      machines, or EMACS_INT, which may be unnecessarily wide.
      * lisp.h (struct Lisp_Subr.function.aMANY)
      (DEFUN_ARGS_MANY, internal_condition_case_n, safe_call):
      Arg counts are now ptrdiff_t, not size_t.
      All variadic functions and their callers changed accordingly.
      (struct gcpro.nvars): Now size_t, not size_t.  All uses changed.
      * bytecode.c (exec_byte_code): Check maxdepth for overflow,
      to avoid potential buffer overrun.  Don't assume arg counts fit in 'int'.
      * callint.c (Fcall_interactively): Check arg count for overflow,
      to avoid potential buffer overrun.  Use signed char, not 'int',
      for 'varies' array, so that we needn't bother to check its size
      calculation for overflow.
      * editfns.c (Fformat): Use ptrdiff_t, not EMACS_INT, to count args.
      * eval.c (apply_lambda):
      * fns.c (Fmapconcat): Use XFASTINT, not XINT, to get args length.
      (struct textprop_rec.argnum): Now ptrdiff_t, not int.  All uses changed.
      (mapconcat): Use ptrdiff_t, not int and EMACS_INT, to count args.
      f66c7cf8
  5. 08 Jun, 2011 1 commit
    • Paul Eggert's avatar
      * alloc.c: Catch some string size overflows that we were missing. · c9d624c6
      Paul Eggert authored
      (XMALLOC_OVERRUN_CHECK_SIZE) [!XMALLOC_OVERRUN_CHECK]: Define to 0,
      for convenience in STRING_BYTES_MAX.
      (STRING_BYTES_MAX): New macro, superseding the old one in lisp.h.
      The definition here is exact; the one in lisp.h was approximate.
      (allocate_string_data): Check for string overflow.  This catches
      some instances we weren't catching before.  Also, it catches
      size_t overflow on (unusual) hosts where SIZE_MAX <= min
      (PTRDIFF_MAX, MOST_POSITIVE_FIXNUM), e.g., when size_t is 32 bits
      and ptrdiff_t and EMACS_INT are both 64 bits.
      * character.c, coding.c, doprnt.c, editfns.c, eval.c:
      All uses of STRING_BYTES_MAX replaced by STRING_BYTES_BOUND.
      * lisp.h (STRING_BYTES_BOUND): Renamed from STRING_BYTES_MAX.
      c9d624c6
  6. 06 Jun, 2011 1 commit
    • Paul Eggert's avatar
      Check for buffer and string overflow more precisely. · d1f3d2af
      Paul Eggert authored
      * buffer.h (BUF_BYTES_MAX): New macro.
      * lisp.h (STRING_BYTES_MAX): New macro.
      * alloc.c (Fmake_string):
      * character.c (string_escape_byte8):
      * coding.c (coding_alloc_by_realloc):
      * doprnt.c (doprnt):
      * editfns.c (Fformat):
      * eval.c (verror):
      Use STRING_BYTES_MAX, not MOST_POSITIVE_FIXNUM,
      since they may not be the same number.
      * editfns.c (Finsert_char):
      * fileio.c (Finsert_file_contents):
      Likewise for BUF_BYTES_MAX.
      d1f3d2af
  7. 04 Jun, 2011 1 commit
    • Paul Eggert's avatar
      Check for buffer and string overflow more precisely. · edaa1822
      Paul Eggert authored
      * buffer.h (BUF_BYTES_MAX): New macro.
      * lisp.h (STRING_BYTES_MAX): New macro.
      * alloc.c (Fmake_string):
      * character.c (string_escape_byte8):
      * coding.c (coding_alloc_by_realloc):
      * doprnt.c (doprnt):
      * editfns.c (Fformat):
      * eval.c (verror):
      Use STRING_BYTES_MAX, not MOST_POSITIVE_FIXNUM,
      since they may not be the same number.
      * editfns.c (Finsert_char):
      * fileio.c (Finsert_file_contents):
      Likewise for BUF_BYTES_MAX.
      edaa1822
  8. 29 May, 2011 1 commit
  9. 28 May, 2011 1 commit
    • Paul Eggert's avatar
      [ChangeLog] · 55d4c1b2
      Paul Eggert authored
      Use 'inline', not 'INLINE'.
      * configure.in, autogen/config.in (INLINE): Remove.
      [lib-src/ChangeLog]
      Use 'inline', not 'INLINE'.
      * etags.c (hash): Now inline unconditionally.
      * make-docfile.c (put_char): inline, not INLINE.
      [nt/ChangeLog]
      Use 'inline', not 'INLINE'.
      * config.nt (INLINE): Remove.
      [src/ChangeLog]
      Use 'inline', not 'INLINE'.
      * alloc.c, fontset.c (INLINE): Remove.
      * alloc.c, bidi.c, charset.c, coding.c, dispnew.c, fns.c, image.c:
      * intervals.c, keyboard.c, process.c, syntax.c, textprop.c, w32term.c:
      * xdisp.c, xfaces.c, xterm.c: Replace all uses of INLINE with inline.
      * gmalloc.c (register_heapinfo): Use inline unconditionally.
      * lisp.h (LISP_MAKE_RVALUE): Use inline, not __inline__.
      55d4c1b2
  10. 09 May, 2011 1 commit
    • Eli Zaretskii's avatar
      Backport revisions... · 14fe7b53
      Eli Zaretskii authored
      Backport revisions 2011-04-24T05:30:24Z!eggert@cs.ucla.edu..2011-04-25T19:40:22Z!eggert@cs.ucla.edu (inclusive) from trunk (bug#8623)
      
      	The next log entry shows the actual changes by Paul Eggert.
      
       Fix a problem with aliasing and vector headers.
       GCC 4.6.0 optimizes based on type-based alias analysis.  For
       example, if b is of type struct buffer * and v of type struct
       Lisp_Vector *, then gcc -O2 was incorrectly assuming that &b->size
       != &v->size, and therefore "v->size = 1; b->size = 2; return
       v->size;" must therefore return 1.  This assumption is incorrect
       for Emacs, since it type-puns struct Lisp_Vector * with many other
       types.  To fix this problem, this patch adds a new type struct
       vector_header that documents the constraints on layout of vectors
       and pseudovectors, and helps optimizing compilers not get fooled
       by Emacs's type punning.  It also adds the macros XSETTYPED_PVECTYPE
       XSETTYPED_PSEUDOVECTOR, TYPED_PSEUDOVECTORP, for similar reasons.
       src/lisp.h (XVECTOR_SIZE): New convenience macro.  All previous uses of
       XVECTOR (foo)->size replaced to use this macro, to avoid the hassle
       of writing XVECTOR (foo)->header.size.
       src/lisp.h: Say "vectorlike header" rather than "vector header.
       (struct vectorlike_header): Rename from struct vector_header.
       (XVECTORLIKE_HEADER_SIZE): Renamed from XVECTOR_HEADER_SIZE.
       All uses changed.
       (XVECTOR_HEADER_SIZE): New macro, for use in XSETPSEUDOVECTOR.
       (XSETTYPED_PVECTYPE): New macro, specifying the name of the size
       member.
       (XSETPVECTYPE): Rewrite in terms of new macro.
       (XSETPVECTYPESIZE): New macro, specifying both type and size.
       This is a bit clearer, and further avoids the possibility of
       undesirable aliasing.
       (XSETTYPED_PSEUDOVECTOR): New macro, specifying the size.
       (XSETPSEUDOVECTOR): Rewrite in terms of XSETTYPED_PSEUDOVECTOR
       and XVECTOR_HEADER_SIZE.
       (XSETSUBR): Rewrite in terms of XSETTYPED_PSEUDOVECTOR and XSIZE,
       since Lisp_Subr is a special case (no "next" field).
       (ASIZE): Rewrite in terms of XVECTOR_SIZE.
       (struct vector_header): New type.
       (TYPED_PSEUDOVECTORP): New macro, also specifying the C type of the
       object, to help avoid aliasing.
       (PSEUDOVECTORP): Rewrite in terms of TYPED_PSEUDOVECTORP.
       (SUBRP): Likewise, since Lisp_Subr is a special case.
       src/lisp.h (struct Lisp_Vector, struct Lisp_Char_Table):
       (struct Lisp_Sub_Char_Table, struct Lisp_Bool_Vector):
       (struct Lisp_Hash_Table): Combine first two members into a single
       struct vector_header member.  All uses of "size" and "next" members
       changed to be "header.size" and "header.next".
       src/buffer.h (struct buffer): Likewise.
       src/font.h (struct font_spec, struct font_entity, struct font): Likewise.
       src/frame.h (struct frame): Likewise.
       src/process.h (struct Lisp_Process): Likewise.
       src/termhooks.h (struct terminal): Likewise.
       src/window.c (struct save_window_data, struct saved_window): Likewise.
       src/window.h (struct window): Likewise.
       src/alloc.c (allocate_buffer, Fmake_bool_vector, allocate_pseudovector):
       Use XSETPVECTYPESIZE, not XSETPVECTYPE, to avoid aliasing problems.
       src/buffer.c (init_buffer_once): Likewise.
       src/lread.c (defsubr): Use XSETTYPED_PVECTYPE, since Lisp_Subr is a
       special case.
       src/process.c (Fformat_network_address): Use local var for size,
       for brevity.
       src/fns.c (vector): Remove; this old hack is no longer needed.
       src/bytecode.c (exec_byte_code): Don't use XVECTOR before CHECK_VECTOR.
      14fe7b53
  11. 01 May, 2011 1 commit
  12. 29 Apr, 2011 1 commit
    • Eli Zaretskii's avatar
      Lift the MOST_POSITIVE_FIXNUM/4 limitation on visited files (bug#8528). · 15cbd324
      Eli Zaretskii authored
       src/fileio.c (Finsert_file_contents): Don't limit file size to 1/4
       of MOST_POSITIVE_FIXNUM.
       src/coding.c (coding_alloc_by_realloc): Error out if destination
       will grow beyond MOST_POSITIVE_FIXNUM.
       (decode_coding_emacs_mule): Abort if there isn't enough place in
       charbuf for the composition carryover bytes.  Reserve an extra
       space for up to 2 characters produced in a loop.
       (decode_coding_iso_2022): Abort if there isn't enough place in
       charbuf for the composition carryover bytes.
      15cbd324
  13. 27 Apr, 2011 1 commit
    • Eli Zaretskii's avatar
      Improve `doprnt' and its usage. (Bug#8545) · 94dcfacf
      Eli Zaretskii authored
       src/doprnt.c (doprnt): Make sure `format' is never accessed beyond
       `format_end'.  Remove support for %l as a conversion specifier.
       Don't use xrealloc.  Improve diagnostics when the %l size modifier
       is used.  Update the commentary.
       src/eval.c (verror): Simplify calculation of size_t.
       src/coding.c (Ffind_operation_coding_system): Fix diagnostic error
       messages.
      94dcfacf
  14. 25 Apr, 2011 2 commits
    • Paul Eggert's avatar
      * lisp.h: (XVECTOR_SIZE): Remove. All uses replaced with ASIZE. · 77b37c05
      Paul Eggert authored
      (ASIZE): Now contains previous implementation of XVECTOR_SIZE
      instead of invoking XVECTOR_SIZE.
      77b37c05
    • Paul Eggert's avatar
      lisp.h: Fix a problem with aliasing and vector headers. · eab3844f
      Paul Eggert authored
      GCC 4.6.0 optimizes based on type-based alias analysis.  For
      example, if b is of type struct buffer * and v of type struct
      Lisp_Vector *, then gcc -O2 was incorrectly assuming that &b->size
      != &v->size, and therefore "v->size = 1; b->size = 2; return
      v->size;" must therefore return 1.  This assumption is incorrect
      for Emacs, since it type-puns struct Lisp_Vector * with many other
      types.  To fix this problem, this patch adds a new type struct
      vector_header that documents the constraints on layout of vectors
      and pseudovectors, and helps optimizing compilers not get fooled
      by Emacs's type punning.  It also adds the macros XSETTYPED_PVECTYPE
      XSETTYPED_PSEUDOVECTOR, TYPED_PSEUDOVECTORP, for similar reasons.
      * lisp.h (XVECTOR_SIZE): New convenience macro.  All previous uses of
      XVECTOR (foo)->size replaced to use this macro, to avoid the hassle
      of writing XVECTOR (foo)->header.size.
      (XVECTOR_HEADER_SIZE): New macro, for use in XSETPSEUDOVECTOR.
      (XSETTYPED_PVECTYPE): New macro, specifying the name of the size
      member.
      (XSETPVECTYPE): Rewrite in terms of new macro.
      (XSETPVECTYPESIZE): New macro, specifying both type and size.
      This is a bit clearer, and further avoids the possibility of
      undesirable aliasing.
      (XSETTYPED_PSEUDOVECTOR): New macro, specifying the size.
      (XSETPSEUDOVECTOR): Rewrite in terms of XSETTYPED_PSEUDOVECTOR
      and XVECTOR_HEADER_SIZE.
      (XSETSUBR): Rewrite in terms of XSETTYPED_PSEUDOVECTOR and XSIZE,
      since Lisp_Subr is a special case (no "next" field).
      (ASIZE): Rewrite in terms of XVECTOR_SIZE.
      (struct vector_header): New type.
      (TYPED_PSEUDOVECTORP): New macro, also specifying the C type of the
      object, to help avoid aliasing.
      (PSEUDOVECTORP): Rewrite in terms of TYPED_PSEUDOVECTORP.
      (SUBRP): Likewise, since Lisp_Subr is a special case.
      * lisp.h (struct Lisp_Vector, struct Lisp_Char_Table):
      (struct Lisp_Sub_Char_Table, struct Lisp_Bool_Vector):
      (struct Lisp_Hash_Table): Combine first two members into a single
      struct vector_header member.  All uses of "size" and "next" members
      changed to be "header.size" and "header.next".
      * buffer.h (struct buffer): Likewise.
      * font.h (struct font_spec, struct font_entity, struct font): Likewise.
      * frame.h (struct frame): Likewise.
      * process.h (struct Lisp_Process): Likewise.
      * termhooks.h (struct terminal): Likewise.
      * window.c (struct save_window_data, struct saved_window): Likewise.
      * window.h (struct window): Likewise.
      * alloc.c (allocate_buffer, Fmake_bool_vector, allocate_pseudovector):
      Use XSETPVECTYPESIZE, not XSETPVECTYPE, to avoid aliasing problems.
      * buffer.c (init_buffer_once): Likewise.
      * lread.c (defsubr): Use XSETTYPED_PVECTYPE, since Lisp_Subr is a
      special case.
      * process.c (Fformat_network_address): Use local var for size,
      for brevity.
      eab3844f
  15. 23 Apr, 2011 1 commit
    • Eli Zaretskii's avatar
      Fix doprnt so it could be used safely in `verror'. (Bug#8435) · e6c3da20
      Eli Zaretskii authored
       src/doprnt.c: Include limits.h.
       (SIZE_MAX): New macro.
       (doprnt): Return a size_t value.  2nd arg is now size_t.  Many
       local variables are now size_t instead of int or unsigned.
       Improve overflow protection.  Support `l' modifier for integer
       conversions.  Support %l conversion.  Don't assume an EMACS_INT
       argument for integer conversions and for %c.
       src/lisp.h (doprnt): Restore prototype.
       src/makefile.w32-in ($(BLD)/callint.$(O)): Depend on
       $(SRC)/character.h.
       src/Makefile.in (base_obj): Add back doprnt.o.
       src/deps.mk (doprnt.o): Add back prerequisites.
       (callint.o): Depend on character.h.
       src/eval.c (internal_lisp_condition_case): Include the handler
       representation in the error message.
       (verror): Call doprnt instead of vsnprintf.  Fix an off-by-one bug
       when breaking from the loop.
       src/xdisp.c (vmessage): Call doprnt instead of vsnprintf.
       src/callint.c (Fcall_interactively): When displaying error message
       about invalid control letter, pass the character's codepoint, not
       a pointer to its multibyte form.  Improve display of the character
       in octal and display also its hex code.
       src/character.c (char_string): Use %x to display the (unsigned)
       codepoint of an invalid character, to avoid displaying a bogus
       negative value.
       src/font.c (check_otf_features): Pass SDATA of SYMBOL_NAME to
       `error', not SYMBOL_NAME itself.
       src/coding.c (Fencode_sjis_char, Fencode_big5_char): Use %c for
       character arguments to `error'.
       src/charset.c (check_iso_charset_parameter): Fix incorrect argument
       to `error' in error message about FINAL_CHAR argument.  Make sure
       FINAL_CHAR is a character, and use %c when it is passed as
       argument to `error'.
      e6c3da20
  16. 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.
      c2982e87
  17. 14 Apr, 2011 1 commit
  18. 11 Apr, 2011 3 commits
    • Paul Eggert's avatar
      * coding.h (coding, code_convert_region, encode_coding_gap): Remove · 74ab6df5
      Paul Eggert authored
      decls.
      * coding.c (Vsjis_coding_system, Vbig5_coding_system):
      (iso_code_class, detect_coding, code_convert_region): Now static.
      (encode_coding_gap): Remove; unused.
      74ab6df5
    • 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.
      955cbe7b
    • 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.
      16a97296
  19. 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
       EMACS_INT.
       (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
       EMACS_INT.
      a53e2e89
  20. 07 Apr, 2011 1 commit
    • 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.
      5fdb398c
  21. 06 Apr, 2011 1 commit
  22. 05 Apr, 2011 2 commits
  23. 01 Apr, 2011 1 commit
    • Paul Eggert's avatar
      * coding.c: Remove vars that are set but not used. · 66ebf983
      Paul Eggert authored
      (DECODE_COMPOSITION_RULE): Remove 2nd arg, which is unused.
      All callers changed.
      (decode_coding_utf_8, decode_coding_utf_16 decode_coding_emacs_mule):
      (decode_coding_iso_2022, encode_coding_sjis, encode_coding_big5):
      (decode_coding_charset): Remove vars that are set but not used.
      66ebf983
  24. 28 Mar, 2011 1 commit
    • 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.
      461c2ab9
  25. 27 Mar, 2011 1 commit
  26. 22 Mar, 2011 1 commit
  27. 15 Mar, 2011 1 commit
  28. 08 Mar, 2011 8 commits
  29. 16 Feb, 2011 1 commit
    • Tom Tromey's avatar
      Change B_ to BVAR · 4b4deea2
      Tom Tromey authored
      	* xfns.c (x_create_tip_frame, Fx_show_tip): Replace B_ with BVAR.
      	* xfaces.c (compute_char_face): Replace B_ with BVAR.
      	* xdisp.c (pos_visible_p, init_iterator, reseat_1)
      	(message_dolog, update_echo_area, ensure_echo_area_buffers)
      	(with_echo_area_buffer, setup_echo_area_for_printing)
      	(set_message_1, update_menu_bar, update_tool_bar)
      	(text_outside_line_unchanged_p, redisplay_internal)
      	(try_scrolling, try_cursor_movement, redisplay_window)
      	(try_window_reusing_current_matrix, row_containing_pos)
      	(try_window_id, get_overlay_arrow_glyph_row, display_line)
      	(Fcurrent_bidi_paragraph_direction, display_mode_lines)
      	(decode_mode_spec_coding, decode_mode_spec, display_count_lines)
      	(get_window_cursor_type, note_mouse_highlight): Replace B_ with
      	BVAR.
      	* window.c (window_display_table, unshow_buffer, window_loop)
      	(window_min_size_2, set_window_buffer, Fset_window_buffer)
      	(select_window, Fforce_window_update, temp_output_buffer_show)
      	(Fset_window_configuration, save_window_save): Replace B_ with
      	BVAR.
      	* w32fns.c (x_create_tip_frame, Fx_show_tip, Fw32_shell_execute):
      	Replace B_ with BVAR.
      	* undo.c (record_point, record_insert, record_delete)
      	(record_marker_adjustment, record_first_change)
      	(record_property_change, Fundo_boundary, truncate_undo_list)
      	(Fprimitive_undo): Replace B_ with BVAR.
      	* syntax.h (Vstandard_syntax_table, CURRENT_SYNTAX_TABLE)
      	(SETUP_BUFFER_SYNTAX_TABLE): Replace B_ with BVAR.
      	* syntax.c (update_syntax_table, dec_bytepos, Fsyntax_table)
      	(Fset_syntax_table, Fmodify_syntax_entry, skip_chars)
      	(skip_syntaxes, scan_lists): Replace B_ with BVAR.
      	* search.c (compile_pattern_1, compile_pattern, looking_at_1)
      	(string_match_1, fast_looking_at, newline_cache_on_off)
      	(search_command, search_buffer, simple_search, boyer_moore)
      	(Freplace_match): Replace B_ with BVAR.
      	* process.c (get_process, list_processes_1, Fstart_process)
      	(Fmake_serial_process, Fmake_network_process)
      	(read_process_output, send_process, exec_sentinel)
      	(status_notify, setup_process_coding_systems): Replace B_ with
      	BVAR.
      	* print.c (PRINTDECLARE, PRINTPREPARE, PRINTFINISH, printchar)
      	(strout, print_string, temp_output_buffer_setup, print_object):
      	Replace B_ with BVAR.
      	* msdos.c (IT_frame_up_to_date): Replace B_ with BVAR.
      	* minibuf.c (read_minibuf, get_minibuffer, Fread_buffer): Replace
      	B_ with BVAR.
      	* marker.c (Fmarker_buffer, Fset_marker, set_marker_restricted)
      	(set_marker_both, set_marker_restricted_both, unchain_marker):
      	Replace B_ with BVAR.
      	* lread.c (readchar, unreadchar, openp, readevalloop)
      	(Feval_buffer, Feval_region): Replace B_ with BVAR.
      	* lisp.h (DOWNCASE_TABLE, UPCASE_TABLE): Replace B_ with BVAR.
      	* keymap.c (Flocal_key_binding, Fuse_local_map)
      	(Fcurrent_local_map, push_key_description)
      	(Fdescribe_buffer_bindings): Replace B_ with BVAR.
      	* keyboard.c (command_loop_1, read_char_minibuf_menu_prompt)
      	(read_key_sequence): Replace B_ with BVAR.
      	* intervals.h (TEXT_PROP_MEANS_INVISIBLE): Replace B_ with BVAR.
      	* intervals.c (set_point_both, get_local_map): Replace B_ with
      	BVAR.
      	* insdel.c (check_markers, insert_char, insert_1_both)
      	(insert_from_string_1, insert_from_gap, insert_from_buffer_1)
      	(adjust_after_replace, replace_range, del_range_2)
      	(modify_region, prepare_to_modify_buffer)
      	(Fcombine_after_change_execute): Replace B_ with BVAR.
      	* indent.c (buffer_display_table, recompute_width_table)
      	(width_run_cache_on_off, current_column, scan_for_column)
      	(Findent_to, position_indentation, compute_motion, vmotion):
      	Replace B_ with BVAR.
      	* fringe.c (get_logical_cursor_bitmap)
      	(get_logical_fringe_bitmap, update_window_fringes): Replace B_
      	with BVAR.
      	* frame.c (make_frame_visible_1): Replace B_ with BVAR.
      	* font.c (font_at): Replace B_ with BVAR.
      	* fns.c (Fbase64_encode_region, Fbase64_decode_region, Fmd5):
      	Replace B_ with BVAR.
      	* filelock.c (unlock_all_files, Flock_buffer, Funlock_buffer)
      	(unlock_buffer): Replace B_ with BVAR.
      	* fileio.c (Fexpand_file_name, Ffile_directory_p)
      	(Ffile_regular_p, Ffile_selinux_context)
      	(Fset_file_selinux_context, Ffile_modes, Fset_file_modes)
      	(Fset_file_times, Ffile_newer_than_file_p, decide_coding_unwind)
      	(Finsert_file_contents, choose_write_coding_system)
      	(Fwrite_region, build_annotations, Fverify_visited_file_modtime)
      	(Fset_visited_file_modtime, auto_save_error, auto_save_1)
      	(Fdo_auto_save, Fset_buffer_auto_saved): Replace B_ with BVAR.
      	* editfns.c (region_limit, Fmark_marker, save_excursion_save)
      	(save_excursion_restore, Fprevious_char, Fchar_before)
      	(general_insert_function, Finsert_char, Finsert_byte)
      	(make_buffer_string_both, Finsert_buffer_substring)
      	(Fcompare_buffer_substrings, subst_char_in_region_unwind)
      	(subst_char_in_region_unwind_1, Fsubst_char_in_region)
      	(Ftranslate_region_internal, save_restriction_restore)
      	(Fchar_equal): Replace B_ with BVAR.
      	* dispnew.c (Fframe_or_buffer_changed_p): Replace B_ with BVAR.
      	* dispextern.h (WINDOW_WANTS_MODELINE_P)
      	(WINDOW_WANTS_HEADER_LINE_P): Replace B_ with BVAR.
      	* dired.c (directory_files_internal): Replace B_ with BVAR.
      	* data.c (swap_in_symval_forwarding, set_internal)
      	(Fmake_local_variable, Fkill_local_variable, Flocal_variable_p):
      	Replace B_ with BVAR.
      	* composite.c (fill_gstring_header)
      	(composition_compute_stop_pos, composition_adjust_point)
      	(Ffind_composition_internal): Replace B_ with BVAR.
      	* coding.c (decode_coding, encode_coding)
      	(make_conversion_work_buffer, decode_coding_gap)
      	(decode_coding_object, encode_coding_object)
      	(Fdetect_coding_region, Ffind_coding_systems_region_internal)
      	(Funencodable_char_position, Fcheck_coding_systems_region):
      	Replace B_ with BVAR.
      	* cmds.c (Fself_insert_command, internal_self_insert): Replace B_
      	with BVAR.
      	* charset.c (Ffind_charset_region): Replace B_ with BVAR.
      	* character.h (FETCH_CHAR_ADVANCE, INC_BOTH, DEC_BOTH)
      	(ASCII_CHAR_WIDTH): Replace B_ with BVAR.
      	* character.c (chars_in_text, Fget_byte): Replace B_ with BVAR.
      	* category.h (Vstandard_category_table): Replace B_ with BVAR.
      	* category.c (check_category_table, Fcategory_table)
      	(Fset_category_table, char_category_set): Replace B_ with BVAR.
      	* casetab.c (Fcurrent_case_table, set_case_table): Replace B_ with
      	BVAR.
      	* casefiddle.c (casify_object, casify_region): Replace B_ with
      	BVAR.
      	* callproc.c (Fcall_process, Fcall_process_region): Replace B_
      	with BVAR.
      	* callint.c (check_mark, Fcall_interactively): Replace B_ with
      	BVAR.
      	* bytecode.c (Fbyte_code): Replace B_ with BVAR.
      	* buffer.h (FETCH_CHAR, FETCH_CHAR_AS_MULTIBYTE, BVAR): Replace B_
      	with BVAR.
      	* buffer.c (Fbuffer_live_p, Fget_file_buffer)
      	(get_truename_buffer, Fget_buffer_create)
      	(clone_per_buffer_values, Fmake_indirect_buffer, reset_buffer)
      	(reset_buffer_local_variables, Fbuffer_name, Fbuffer_file_name)
      	(Fbuffer_local_value, buffer_lisp_local_variables)
      	(Fset_buffer_modified_p, Frestore_buffer_modified_p)
      	(Frename_buffer, Fother_buffer, Fbuffer_enable_undo)
      	(Fkill_buffer, Fset_buffer_major_mode, set_buffer_internal_1)
      	(set_buffer_temp, Fset_buffer, set_buffer_if_live)
      	(Fbarf_if_buffer_read_only, Fbury_buffer, Ferase_buffer)
      	(Fbuffer_swap_text, swapfield_, Fbuffer_swap_text)
      	(Fset_buffer_multibyte, swap_out_buffer_local_variables)
      	(record_overlay_string, overlay_strings, init_buffer_once)
      	(init_buffer, syms_of_buffer): Replace B_ with BVAR.
      4b4deea2