summaryrefslogtreecommitdiff
path: root/src/lisp.h
Commit message (Collapse)AuthorAgeFilesLines
* src/lisp.h (syms_of_abbrev): Remove declaration.Juanma Barranquero2011-11-071-4/+0
| | | | Reported by CHENG Gao <chenggao@royau.me>.
* Support MSVC build with newer versions of Visual Studio.Eli Zaretskii2011-11-051-17/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Small portions of the changes by Fabrice Popineau <fabrice.popineau@supelec.fr>. src/makefile.w32-in (TAGS-gmake): Don't use $(patsubst ...), as Nmake barfs on that. Use $(OBJ*_c) variables instead, defined on nt/gmake.defs. src/lisp.h (ENUM_BF): New macro, for enumerated types in bitfields, which are not supported by MSVC. (Lisp_Symbol, Lisp_Misc_Any, Lisp_Marker, Lisp_Misc_Overlay) (Lisp_Save_Value, Lisp_Free): Use ENUM_BF for enumerated types in bitfields. (Lisp_Object) [USE_LISP_UNION_TYPE]: Use ENUM_BF for enumerated types in bitfields. (DEFUN) [_MSC_VER]: Define in a different way for MSVC. src/w32fns.c [_MSC_VER]: DECLARE_HANDLE for any MSVC version. src/w32.c: Don't include w32api.h for MSVC. (init_environment) [_MSC_VER]: Call sys_access, not _access. src/s/ms-w32.h <sigset_t, ssize_t> [_MSC_VER]: Typedefs for MSVC. [_MSC_VER]: Include sys/timeb.h, sys/stat.h, and signal.h. (fstat, stat, utime) [_MSC_VER]: Redirect to their sys_* cousins. (malloc, free, realloc, calloc) [_MSC_VER]: Always redirect to the e_* cousins. (alloca) [_MSC_VER]: Define to _alloca. src/lisp.h (DECL_ALIGN) [_MSC_VER]: Define for MSVC. src/regex.c <re_char> [_MSC_VER]: A separate definition for MSVC. nt/makefile.w32-in (clean-other-dirs-nmake) (distclean-other-dirs-nmake, maintainer-clean-other-dirs-nmake): Update for current structure of doc/ subdirectories. nt/gmake.defs (OBJ0_c, OBJ1_c, OBJ2_c): New variables. nt/INSTALL: Update for newer versions of MSVC. lib/makefile.w32-in (FRC): New dummy target. (TAGS): Depend on FRC. Fixes: debbugs:9960
* * src/lisp.h (struct Lisp_Symbol): Update comments.Stefan Monnier2011-10-281-13/+7
|
* * src/lisp.h (GCPRO1_VAR, GCPRO2_VAR, GCPRO3_VAR, GCPRO4_VAR)Andreas Schwab2011-10-111-58/+58
| | | | | (GCPRO5_VAR, GCPRO6_VAR, UNGCPRO_VAR): Add whitespace to avoid matching a pp-number. Rename parameter var to var1.
* Remove dependency on glibc malloc internals.Paul Eggert2011-09-301-48/+0
| | | | | | | | | | | | | | | * alloc.c (XMALLOC_OVERRUN_CHECK_OVERHEAD, XMALLOC_OVERRUN_CHECK_SIZE): Move back here from lisp.h, but with their new implementations. (XMALLOC_BASE_ALIGNMENT, COMMON_MULTIPLE, XMALLOC_HEADER_ALIGNMENT) (XMALLOC_OVERRUN_SIZE_SIZE): Move these new lisp.h macros here. * charset.c (charset_table_init): New static var. (syms_of_charset): Use it instead of xmalloc. This removes a dependency on glibc malloc internals. See Eli Zaretskii's comment in <http://lists.gnu.org/archive/html/emacs-devel/2011-09/msg00815.html>. * lisp.h (XMALLOC_OVERRUN_CHECK_OVERHEAD, XMALLOC_OVERRUN_CHECK_SIZE): Move back to alloc.c. (XMALLOC_BASE_ALIGNMENT, COMMON_MULTIPLE, XMALLOC_HEADER_ALIGNMENT) (XMALLOC_OVERRUN_SIZE_SIZE): Move to alloc.c.
* Port --enable-checking=all to Fedora 14 x86.Paul Eggert2011-09-291-0/+48
| | | | | | | | | | | | | | | | | | | * alloc.c (XMALLOC_OVERRUN_CHECK_OVERHEAD, XMALLOC_OVERRUN_CHECK_SIZE): Move to lisp.h. (xmalloc_put_size, xmalloc_get_size, overrun_check_malloc) (overrun_check_realloc, overrun_check_free): Use XMALLOC_OVERRUN_SIZE_SIZE, not sizeof (size_t). That way, xmalloc returns a properly-aligned pointer even if XMALLOC_OVERRUN_CHECK is defined. The old debugging code happened to align OK on typical 64-bit hosts, but not on Fedora 14 x86. * charset.c (syms_of_charset): Take XMALLOC_OVERRUN_CHECK_OVERHEAD into account when calculating the initial malloc maximum. * lisp.h (XMALLOC_OVERRUN_CHECK_OVERHEAD, XMALLOC_OVERRUN_CHECK_SIZE): Move here from alloc.c, so that charset.c can use it too. Properly align; the old code wasn't right for common 32-bit hosts when configured with --enable-checking=all. (XMALLOC_BASE_ALIGNMENT, COMMON_MULTIPLE, XMALLOC_HEADER_ALIGNMENT) (XMALLOC_OVERRUN_SIZE_SIZE): New macros.
* * keymap.h (KEY_DESCRIPTION_SIZE, push_key_description): Move declsPaul Eggert2011-09-101-12/+0
| | | | | | | | here ... * lisp.h: ... from here. push_key_description is no longer defined in keyboard.c, so its declaration should not be in lisp.h's "Defined in keyboard.c" section, and KEY_DESCRIPTION_SIZE logically belongs with push_key_description.
* Whitespace changes.Juanma Barranquero2011-09-091-29/+29
|
* * src/doprnt.c (esnprintf): Remove. All uses removed.Paul Eggert2011-09-011-2/+0
| | | | Suggested by Chong Yidong in <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9412#23>.
* sprintf-related integer and memory overflow issues.Paul Eggert2011-08-291-2/+12
| | | | | | | | | | | | | | | | | | | | * doprnt.c (doprnt): Support printing ptrdiff_t and intmax_t values. (esprintf, esnprintf, exprintf, evxprintf): New functions. * keyboard.c (command_loop_level): Now EMACS_INT, not int. (cmd_error): kbd macro iterations count is now EMACS_INT, not int. (modify_event_symbol): Do not assume that the length of name_alist_or_stem is safe to alloca and fits in int. (Fexecute_extended_command): Likewise for function name and binding. (Frecursion_depth): Wrap around reliably on integer overflow. * keymap.c (push_key_description): First arg is now EMACS_INT, not int, since some callers pass EMACS_INT values. (Fsingle_key_description): Don't crash if symbol name contains more than MAX_ALLOCA bytes. * minibuf.c (minibuf_level): Now EMACS_INT, not int. (get_minibuffer): Arg is now EMACS_INT, not int. * lisp.h (get_minibuffer, push_key_description): Reflect API changes. (esprintf, esnprintf, exprintf, evxprintf): New decls. * window.h (command_loop_level, minibuf_level): Reflect API changes.
* Merge from trunk.Paul Eggert2011-08-041-0/+1
|\
| * Make uniprop_table non-static.Kenichi Handa2011-08-021-0/+1
| |
* | Adjust in response to jan.h.d's comments.Paul Eggert2011-08-041-0/+20
| | | | | | | | See, for example <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9196#26>.
* | Integer and memory overflow fixes for display code.Paul Eggert2011-07-281-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * dispextern.h (struct glyph_pool.nglyphs): Now ptrdiff_t, not int. * dispnew.c (adjust_glyph_matrix, realloc_glyph_pool, scrolling_window): Check for overflow in size calculations. (line_draw_cost, realloc_glyph_pool, add_row_entry): Don't assume glyph table len fits in int. (struct row_entry.bucket, row_entry_pool_size, row_entry_idx) (row_table_size): Now ptrdiff_t, not int. (scrolling_window): Avoid overflow in size calculations. Don't update size until allocation succeeds. * fns.c (concat): Check for overflow in size calculations. (next_almost_prime): Verify NEXT_ALMOST_PRIME_LIMIT. * lisp.h (RANGED_INTEGERP, TYPE_RANGED_INTEGERP): New macros. (NEXT_ALMOST_PRIME_LIMIT): New constant.
* | Use ptrdiff_t for hash table indexes.Paul Eggert2011-07-181-2/+2
|/ | | | | | | | | | | | | | | | * 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).
* Improve hashing quality when configured --with-wide-int.Paul Eggert2011-07-071-0/+1
| | | | | | | | | | | * fns.c (hash_string): New function, taken from sxhash_string. Do not discard information about ASCII character case; this discarding is no longer needed. (sxhash-string): Use it. Change sig to match it. Caller changed. * lisp.h: Declare it. * lread.c (hash_string): Remove, since we now use fns.c's version. The fns.c version returns a wider integer if --with-wide-int is specified, so this should help the quality of the hashing a bit.
* * editfns.c (pWIDE, pWIDElen, signed_wide, unsigned_wide):Paul Eggert2011-07-071-0/+17
| | | | | | | | | | | Remove, replacing with the new symbols in lisp.h. All uses changed. * fileio.c (make_temp_name): * filelock.c (lock_file_1, lock_file): * xdisp.c (message_dolog): Don't assume PRIdMAX etc. works; this isn't portable to pre-C99 hosts. Use pMd etc. instead. * lisp.h (printmax_t, uprintmax_t, pMd, pMu): New types and macros, replacing the pWIDE etc. symbols removed from editfns.c.
* * doprnt.c: Prefer signed to unsigned when either works.Paul Eggert2011-07-061-1/+2
| | | | | | | | | | | | * eval.c (verror): * doprnt.c (doprnt): * lisp.h (doprnt): * xdisp.c (vmessage): Use ptrdiff_t, not size_t, when using or implementing doprnt, since the sizes cannot exceed ptrdiff_t bounds anyway, and we prefer signed arithmetic to avoid comparison confusion. * doprnt.c (doprnt): Avoid a "+ 1" that can't overflow, but is a bit tricky.
* [ChangeLog]Paul Eggert2011-07-041-12/+0
| | | | | | | | | | | | | | | | | | | Assume support for memcmp, memcpy, memmove, memset. This simplifies the code a bit. All current platforms have these, as they are required for C89. If this turns into a problem we can add the gnulib modules for these (a 1-line change to Makefile.in). * configure.in: Don't check for memcmp, memcpy, memmove, memset. [lib-src/ChangeLog] Assume support for memcmp, memcpy, memmove, memset. * etags.c (absolute_filename): Assume memmove exists. [src/ChangeLog] Assume support for memcmp, memcpy, memmove, memset. * lisp.h, sysdep.c (memcmp, memcpy, memmove, memset): * regex.c (memcmp, memcpy): Remove; we assume C89 now. * gmalloc.c (memcpy, memset, memmove): Remove; we assume C89 now. (__malloc_safe_bcopy): Remove; no longer needed.
* * lisp.h (struct vectorlike_header, struct Lisp_Subr): Signed sizes.Paul Eggert2011-07-041-2/+2
| | | | | Use EMACS_INT, not EMACS_UINT, for sizes. The code works equally well either way, and we prefer signed to unsigned.
* Move DEFSYM to lisp.h and use everywhere.Juanma Barranquero2011-06-241-0/+3
|
* * lisp.h (DEFVAR_KBOARD): Use offsetof instead of char * finagling.Paul Eggert2011-06-221-4/+1
|
* * dispextern.h (struct face.stipple):Paul Eggert2011-06-211-1/+1
| | | | | | | | | | | | | | | | | | * image.c (x_bitmap_height, x_bitmap_width, x_bitmap_pixmap) (x_bitmap_mask, x_allocate_bitmap_record) (x_create_bitmap_from_data, x_create_bitmap_from_file) (x_destroy_bitmap, x_destroy_all_bitmaps, x_create_bitmap_mask) (x_create_bitmap_from_xpm_data): * nsterm.h (struct ns_display_info.bitmaps_size, .bitmaps_last): * w32term.h (struct w32_display_info.icon_bitmap_id, .bitmaps_size) (.bitmaps_last): * xfaces.c (load_pixmap): * xterm.c (x_bitmap_icon, x_wm_set_icon_pixmap): * xterm.h (struct x_display_info.icon_bitmap_id, .bitmaps_size) (.bitmaps_last, struct x_output.icon_bitmap): Use ptrdiff_t, not int, for bitmap indexes. (x_allocate_bitmap_record): Check for size overflow. * dispextern.h, lisp.h: Adjust to API changes elsewhere.
* * lisp.h (make_fixnum_or_float): Remove unnecessary cast to EMACS_INT.Paul Eggert2011-06-181-3/+1
|
* * lisp.h (LIST_END_P): Remove unused macro and its bogus comment.Paul Eggert2011-06-181-18/+0
|
* * lisp.h (DEFUN): Remove bogus use of sizeof (struct Lisp_Subr).Paul Eggert2011-06-181-1/+1
| | | | | | This didn't break anything, but it didn't help either. It's confusing to put a bogus integer in a place where the actual value does not matter.
* * lisp.h (XSET) [USE_LISP_UNION_TYPE]: Use uintptr_t and intptr_t,Paul Eggert2011-06-181-3/+3
| | | | | not EMACS_UINT and EMACS_INT, when converting pointer to integer. This avoids a GCC warning when WIDE_EMACS_INT.
* * lisp.h (struct Lisp_Bool_Vector.size): EMACS_INT, not EMACS_UINT.Paul Eggert2011-06-181-1/+1
| | | | | We prefer signed types, and the value cannot exceed the EMACS_INT range anyway (because otherwise the length would not be representable).
* * lisp.h (union Lisp_Object.i): EMACS_INT, not EMACS_UINT.Paul Eggert2011-06-181-2/+2
| | | | | This is for consistency with the ordinary, non-USE_LISP_UNION_TYPE, implementation.
* * lisp.h (lint_assume): New macro.Paul Eggert2011-06-181-1/+9
| | | | | * composite.c (composition_gstring_put_cache): * ftfont.c (ftfont_shape_by_flt): Use it to pacify GCC 4.6.0.
* * lisp.h: Include <limits.h>, for INT_MAX, LONG_MAX, LLONG_MAX.Paul Eggert2011-06-161-0/+1
| | | | | Without this, prin1 mishandles Lisp_Misc_Save_Value printing on hosts with pre-C99 libraries, because pD is wrongly defined to "t".
* * insdel.c, lisp.h (buffer_overflow): New function.Paul Eggert2011-06-151-0/+1
| | | | | | | (insert_from_buffer_1, replace_range, replace_range_2): * insdel.c (make_gap_larger): * editfns.c (Finsert_char): * fileio.c (Finsert_file_contents): Use it, to normalize wording.
* Variadic C functions now count arguments with ptrdiff_t.Paul Eggert2011-06-141-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* Merge from trunk.Paul Eggert2011-06-131-2/+3
|\
| * * buffer.c (Qclone_number): Remove for now, as it's unused.Paul Eggert2011-06-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (record_buffer, Funrecord_buffer): Rename local to avoid shadowing. (record_buffer): Remove unused local. * frame.c (other_visible_frames, frame_buffer_list): Now static. (set_frame_buffer_list): Remove; unused. * frame.h (other_visible_frames): Remove decl. * keyboard.h (menu_items_inuse): Declare only if USE_GTK || USE_MOTIF. * lisp.h (frame_buffer_list, set_frame_buffer_list): Remove decls. (add_gpm_wait_descriptor, delete_gpm_wait_descriptor): Declare only if HAVE_GPM. * menu.c (menu_items_inuse): Now static unless USE_GTK || USE_MOTIF. * process.c (add_gpm_wait_descriptor, delete_gpm_wait_descriptor): Define only if HAVE_GPM. * widget.c (EmacsFrameResize, emacsFrameClassRec): Now static. (update_hints_inhibit): Remove; never set. All uses removed. * widgetprv.h (emacsFrameClassRec): Remove decl. * window.c (delete_deletable_window): Now returns void, since it wasn't returning anything. (compare_window_configurations): Remove unused locals. * xfns.c (x_set_scroll_bar_default_width): Remove unused locals. * xmenu.c (x_menu_set_in_use): Define only if USE_GTK || USE_MOTIF. Omit no-longer-needed #ifdef USE_X_TOOLKIT, since USE_X_TOOLKIT is implied by USE_GTK || USE_MOTIF. (dialog_selection_callback) [!USE_GTK]: Prefer intptr_t for integers the same widths as pointers. This follows up on the 2011-05-06 patch. * xterm.c (x_alloc_lighter_color_for_widget): Define only if USE_LUCID. * xterm.h: Likewise. (x_menu_set_in_use): Declare only if USE_GTK || USE_MOTIF.
| * Move/add window-buffer-related functions to window.el.Martin Rudalics2011-06-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * buffer.c: New Lisp objects Qbuffer_list_update_hook and Qclone_number. Remove external declaration of Qdelete_window. (Fbuffer_list): Rewrite doc-string. Minor restructuring of code. (Fget_buffer_create, Fmake_indirect_buffer, Frename_buffer): Run Qbuffer_list_update_hook if allowed. (Fother_buffer): Rewrite doc-string. Major rewrite for new buffer list implementation. (other_buffer_safely): New function. (Fkill_buffer): Replace call to replace_buffer_in_all_windows by calls to replace_buffer_in_windows and replace_buffer_in_windows_safely. Run Qbuffer_list_update_hook if allowed. (record_buffer): Inhibit quitting and rewrite using quittable functions. Run Qbuffer_list_update_hook if allowed. (Frecord_buffer, Funrecord_buffer): New functions. (switch_to_buffer_1, Fswitch_to_buffer): Remove. Move switch-to-buffer to window.el. (bury-buffer): Move to window.el. (Vbuffer_list_update_hook): New variable. * lisp.h (other_buffer_safely): Add prototype in buffer.c section. * window.h (resize_frame_windows): Move up in code. (Fwindow_frame): Remove EXFUN. (replace_buffer_in_all_windows): Remove prototype. (replace_buffer_in_windows_safely): Add prototype. * window.c: Declare Qdelete_window static again. Move down declaration of select_count. (Fnext_window, Fprevious_window): Rewrite doc-strings. (Fother_window): Move to window.el. (window_loop): Remove DELETE_BUFFER_WINDOWS and UNSHOW_BUFFER cases. Add REPLACE_BUFFER_IN_WINDOWS_SAFELY case. (Fdelete_windows_on, Freplace_buffer_in_windows): Move to window.el. (replace_buffer_in_windows): Implement by calling Qreplace_buffer_in_windows. (replace_buffer_in_all_windows): Remove with some functionality moved into replace_buffer_in_windows_safely. (replace_buffer_in_windows_safely): New function. (select_window_norecord, select_frame_norecord): Move in front of run_window_configuration_change_hook. Remove now obsolete declarations. (Fset_window_buffer): Rewrite doc-string. Call Qrecord_window_buffer. (keys_of_window): Move binding for other-window to window.el. * loadup.el (top-level): Load window before files for the sake of replace-buffer-in-windows. * files.el (read-buffer-to-switch) (switch-to-buffer-other-window) (switch-to-buffer-other-frame, display-buffer-other-frame): Move to window.el. * simple.el (get-next-valid-buffer, last-buffer, next-buffer) (previous-buffer): Move to window.el. * bindings.el (unbury-buffer): Move to window.el. * window.el (delete-other-windows-vertically): Move after definition of delete-other-windows. (other-window, delete-windows-on, replace-buffer-in-windows): Move here from window.c. (record-window-buffer, unrecord-window-buffer) (set-window-buffer-start-and-point, switch-to-prev-buffer) (switch-to-next-buffer): New functions. (get-next-valid-buffer, last-buffer, next-buffer): Move here from simple.el. Call switch-to-next-buffer. (previous-buffer): Move here from simple.el. Call switch-to-prev-buffer. (bury-buffer): Move here from buffer.c. Switch to previous buffer when window cannot be deleted. (unbury-buffer): Move here from bindings.el. (ctl-x-map): Move binding for other-window from window.c to here. (read-buffer-to-switch, switch-to-buffer-other-window) (switch-to-buffer-other-frame): Move here from files.el. (normalize-buffer-to-switch-to): New functions. (switch-to-buffer): Move here from buffer.c. Use read-buffer-to-switch and normalize-buffer-to-switch-to.
* | * lisp.h (CHAR_TABLE_SET): Omit now-redundant test.Paul Eggert2011-06-121-2/+1
| |
* | * character.h (CHAR_VALID_P): Remove unused parameter.Paul Eggert2011-06-121-2/+2
| | | | | | | | * fontset.c, lisp.h, xdisp.c: All uses changed.
* | * lisp.h (UNSIGNED_CMP): New macro.Paul Eggert2011-06-121-1/+11
| | | | | | | | | | | | | | | | | | | | | | This fixes comparison bugs on 64-bit hosts. (ASCII_CHAR_P): Use it. * casefiddle.c (casify_object): * character.h (ASCII_BYTE_P, CHAR_VALID_P): (SINGLE_BYTE_CHAR_P, CHAR_STRING): * composite.h (COMPOSITION_ENCODE_RULE_VALID): * dispextern.h (FACE_FROM_ID): * keyboard.c (read_char): Use UNSIGNED_CMP.
* | * lisp.h (SAFE_ALLOCA_LISP): Check for integer overflow.Paul Eggert2011-06-081-7/+23
| | | | | | | | | | | | | | | | | | (struct Lisp_Save_Value): Use ptrdiff_t, not int, for 'integer' member. * alloc.c (make_save_value): Integer argument is now of type ptrdiff_t, not int. (mark_object): Use ptrdiff_t, not int. * lisp.h (pD): New macro. * print.c (print_object): Use it.
* | * alloc.c: Catch some string size overflows that we were missing.Paul Eggert2011-06-081-5/+13
|/ | | | | | | | | | | | | | | (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.
* Merge from trunk.Paul Eggert2011-06-061-4/+0
|\
| * Move some window-related functions from frame.c to window.c.Martin Rudalics2011-06-061-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp.h: Move EXFUNS for Fframe_root_window, Fframe_first_window and Fset_frame_selected_window to window.h. * window.h: Move EXFUNS for Fframe_root_window, Fframe_first_window and Fset_frame_selected_window here from lisp.h. * frame.c (Fwindow_frame, Fframe_first_window) (Fframe_root_window, Fframe_selected_window) (Fset_frame_selected_window): Move to window.c. (Factive_minibuffer_window): Move to minibuf.c. (Fother_visible_frames_p): New function. * minibuf.c (Factive_minibuffer_window): Move here from frame.c. * window.c (Fwindow_frame): Move here from frame.c. Accept any window as argument. (Fframe_root_window, Fframe_first_window) (Fframe_selected_window): Move here from frame.c. Accept frame or arbitrary window as argument. Update doc-strings. (Fminibuffer_window): Move up in code. (Fwindow_minibuffer_p): Move up in code and simplify. (Fset_frame_selected_window): Move here from frame.c. Marginal rewrite. (Fselected_window, select_window, Fselect_window): Move up in code. Minor doc-string fixes.
* | Check for overflow when converting integer to cons and back.Paul Eggert2011-06-061-2/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * charset.c (Fdefine_charset_internal, Fdecode_char): Use cons_to_unsigned to catch overflow. (Fencode_char): Use INTEGER_TO_CONS. * composite.h (LGLYPH_CODE): Use cons_to_unsigned. (LGLYPH_SET_CODE): Use INTEGER_TO_CONS. * data.c (long_to_cons, cons_to_long): Remove. (cons_to_unsigned, cons_to_signed): New functions. These signal an error for invalid or out-of-range values. * dired.c (Ffile_attributes): Use INTEGER_TO_CONS. * fileio.c (Fset_visited_file_modtime): Use CONS_TO_INTEGER. * font.c (Ffont_variation_glyphs): * fontset.c (Finternal_char_font): Use INTEGER_TO_CONS. * lisp.h: Include <intprops.h>. (INTEGER_TO_CONS, CONS_TO_INTEGER): New macros. (cons_to_signed, cons_to_unsigned): New decls. (long_to_cons, cons_to_long): Remove decls. * undo.c (record_first_change): Use INTEGER_TO_CONS. (Fprimitive_undo): Use CONS_TO_INTEGER. * xfns.c (Fx_window_property): Likewise. * xselect.c: Include <limits.h>. (x_own_selection, selection_data_to_lisp_data): Use INTEGER_TO_CONS. (x_handle_selection_request, x_handle_selection_clear) (x_get_foreign_selection, Fx_disown_selection_internal) (Fx_get_atom_name, x_send_client_event): Use CONS_TO_INTEGER. (lisp_data_to_selection_data): Use cons_to_unsigned. (x_fill_property_data): Use cons_to_signed. Report values out of range.
* | Check for buffer and string overflow more precisely.Paul Eggert2011-06-051-0/+6
|/ | | | | | | | | | | | | | | | * 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.
* Merge from trunk.Paul Eggert2011-06-021-24/+23
|\
| * Remove arbitrary limit of 2**31 entries in hash tables.Paul Eggert2011-05-301-24/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * category.c (hash_get_category_set): Use 'EMACS_UINT' and 'EMACS_INT' for hashes and hash indexes, instead of 'unsigned' and 'int'. * ccl.c (ccl_driver): Likewise. * charset.c (Fdefine_charset_internal): Likewise. * charset.h (struct charset.hash_index): Likewise. * composite.c (get_composition_id, gstring_lookup_cache): (composition_gstring_put_cache): Likewise. * composite.h (struct composition.hash_index): Likewise. * dispextern.h (struct image.hash): Likewise. * fns.c (next_almost_prime, larger_vector, cmpfn_eql): (cmpfn_equal, cmpfn_user_defined, hashfn_eq, hashfn_eql): (hashfn_equal, hashfn_user_defined, make_hash_table): (maybe_resize_hash_table, hash_lookup, hash_put): (hash_remove_from_table, hash_clear, sweep_weak_table, SXHASH_COMBINE): (sxhash_string, sxhash_list, sxhash_vector, sxhash_bool_vector): (Fsxhash, Fgethash, Fputhash, Fmaphash): Likewise. * image.c (make_image, search_image_cache, lookup_image): (xpm_put_color_table_h): Likewise. * lisp.h (struct Lisp_Hash_Table): Likewise, for 'count', 'cmpfn', and 'hashfn' members. * minibuf.c (Ftry_completion, Fall_completions, Ftest_completion): Likewise. * print.c (print): Likewise. * alloc.c (allocate_vectorlike): Check for overflow in vector size calculations. * ccl.c (ccl_driver): Check for overflow when converting EMACS_INT to int. * fns.c, image.c: Remove unnecessary static decls that would otherwise need to be updated by these changes. * fns.c (make_hash_table, maybe_resize_hash_table): Check for integer overflow with large hash tables. (make_hash_table, maybe_resize_hash_table, Fmake_hash_table): Prefer the faster XFLOAT_DATA to XFLOATINT where either will do. (SXHASH_REDUCE): New macro. (sxhash_string, sxhash_list, sxhash_vector, sxhash_bool_vector): Use it instead of discarding useful hash info with large hash values. (sxhash_float): New function. (sxhash): Use it. No more need for "& INTMASK" due to above changes. * lisp.h (FIXNUM_BITS): New macro, useful for SXHASH_REDUCE etc. (MOST_NEGATIVE_FIXNUM, MOST_POSITIVE_FIXNUM, INTMASK): Rewrite to use FIXNUM_BITS, as this simplifies things. (next_almost_prime, larger_vector, sxhash, hash_lookup, hash_put): Adjust signatures to match updated version of code. (consing_since_gc): Now EMACS_INT, since a single hash table can use more than INT_MAX bytes.
* | Merge from trunk.Paul Eggert2011-05-301-1/+1
|\|
| * Merge from trunk.Paul Eggert2011-05-301-1/+1
| |\
| * | [ChangeLog]Paul Eggert2011-05-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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__.