summaryrefslogtreecommitdiff
path: root/src/chartab.c
Commit message (Collapse)AuthorAgeFilesLines
* Prefer HTTPS to FTP and HTTP in documentationPaul Eggert2017-09-131-1/+1
| | | | | | | | | | | | | Most of this change is to boilerplate commentary such as license URLs. This change was prompted by ftp://ftp.gnu.org's going-away party, planned for November. Change these FTP URLs to https://ftp.gnu.org instead. Make similar changes for URLs to other organizations moving away from FTP. Also, change HTTP to HTTPS for URLs to gnu.org and fsf.org when this works, as this will further help defend against man-in-the-middle attacks (for this part I omitted the MS-DOS and MS-Windows sources and the test tarballs to keep the workload down). HTTPS is not fully working to lists.gnu.org so I left those URLs alone for now.
* Add PVSIZE function to return the size of a pseudovector.Lars Brinkhoff2017-04-101-1/+1
| | | | | | | | | | | | | | * src/lisp.h (PVSIZE): New function. * src/chartab.c (copy_char_table): * src/data.c (Ftype_of, Finteractive_form, Faref, Faset): * src/doc.c (Fdocumentation, store_function_docstring): * src/eval.c (Fcommandp, funcall_lambda, lambda_arity, Ffetch_bytecode): * src/fns.c (Flength, Fcopy_sequence): * src/font.h (FONT_SPEC_P, FONT_ENTITY_P, FONT_OBJECT_P): * src/lread.c (substitute_object_recurse): * src/src/print.c (print_object): Use it.
* Fix setting a range of char-table slots in a singular caseEli Zaretskii2016-06-191-1/+1
| | | | | | | * src/chartab.c (char_table_set_range): Start the loop from the first character of the block to which FROM belongs. (Bug#23797) * test/src/chartab-tests.el: New test file.
* Rework C source files to avoid ^(Paul Eggert2016-03-101-3/+3
| | | | | | | | Work around Bug#22884 by rewording comments and strings to avoid ‘(’ at the start of a line unless it starts a function. This change is a short-term hack; in the longer run we plan to fix cc-mode’s performance for C files that have ‘(’ at the start of a line in a comment or string.
* Include-file cleanup for src directoryPaul Eggert2015-10-201-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Omit ‘#include "foo.h"’ unless the file needs foo.h (Bug#21707). In a few cases, add ‘#include "foo.h"’ if the file needs foo.h but does not include it directly. As a general rule, a source file should include foo.h if it needs the interfaces that foo.h defines. * src/alloc.c: Don’t include process.h. Include dispextern.h, systime.h. * src/atimer.c: Don’t include blockinput.h. * src/buffer.c: Include coding.h, systime.h. Don’t include keyboard.h, coding.h. * src/callint.c: Don’t include commands.h, keymap.h. * src/callproc.c: Don’t include character.h, ccl.h, composite.h, systty.h, termhooks.h. * src/casetab.c: Don’t include character.h. * src/category.c: Don’t include charset.h, keymap.h. * src/ccl.h: Don’t include character.h. * src/character.c: Don’t include charset.h. * src/charset.c: Don’t include disptab.h. * src/chartab.c: Don’t include ccl.h. * src/cm.c: Don’t include frame.h, termhooks.h. * src/cmds.c: Don’t include window.h, dispextern.h. * src/coding.c: Don’t include window.h, frame.h. * src/composite.c: Include composite.h. Don’t include window.h, font.h. * src/data.c: Don’t include syssignal.h, termhooks.h, font.h. * src/dbusbind.c: Don’t include frame.h. * src/decompress.c: Don’t include character.h. * src/dired.c: Don’t include character.h, commands.h, charset.h. * src/dispnew.c: Don’t include character.h, indent.h, intervals.h, process.h, timespec.h. Include systime.h. * src/doc.c: Include coding.h. Don’t include keyboard.h. * src/editfns.c: Include composite.h. Don’t include frame.h. * src/emacs.c: Include fcntl.h, coding.h. Don’t include commands.h, systty.h.. * src/fileio.c: Don’t include intervals.h, dispextern.h. Include composite.h. * src/filelock.c: Don’t include character.h, systime.h. * src/fns.c: Don’t include time.h, commands.h, keyboard.h, keymap.h, frame.h, blockinput.h, xterm.h. Include composite.h. * src/font.c: Include termhooks.h. * src/font.h: Don’t include ccl.h, frame.h. Add forward decls of struct composition_it, struct face, struct glyph_string. * src/fontset.c: Don’t include buffer.h, ccl.h, keyboard.h, intervals.h, window.h, termhooks.h. * src/frame.c: Don’t include character.h, commands.h, font.h. * src/frame.h: Don’t include dispextern.h. * src/fringe.c: Don’t include character.h. * src/ftcrfont.c: Don’t include dispextern.h, frame.h, character.h, charset.h, fontset.h. * src/ftfont.c: Don’t include frame.h, blockinput.h, coding.h, fontset.h. * src/ftxfont.c: Don’t include dispextern.h, character.h, charset.h, fontset.h. * src/gfilenotify.c: Don’t include frame.h, process.h. * src/gtkutil.c: Include dispextern.h, frame.h, systime.h. Don’t include syssignal.h, buffer.h, charset.h, font.h. * src/gtkutil.h: Don’t include frame.h. * src/image.c: Include fcntl.h and stdio.h instead of sysstdio.h. Don’t include character.h. * src/indent.c: Don’t include keyboard.h, termchar.h. * src/inotify.c: Don’t include character.h, frame.h. * src/insdel.c: Include composite.h. Don’t include blockinput.h. * src/intervals.c: Don’t include character.h, keyboard.h. * src/intervals.h: Don’t include dispextern.h, composite.h. * src/keyboard.c: Don’t include sysstdio.h, disptab.h, puresize.h. Include coding.h. * src/keyboard.h: Don’t incldue systime.h. * src/keymap.c: Don’t include charset.h, frame.h. * src/lread.c: Include dispextern.h and systime.h. Don’t include frame.h. Include systime.h. * src/macros.c: Don’t include commands.h, character.h, buffer.h. * src/menu.c: Include character.h, coding.h. Don’t include dispextern.h. * src/menu.h: Don’t include systime.h. * src/minibuf.c: Don’t include commands.h, dispextern.h, syntax.h, intervals.h, termhooks.h. * src/print.c: Include coding.h. Don’t include keyboard.h, window.h, dispextern.h, termchar.h, termhooks.h, font.h. Add forward decl of struct terminal. * src/process.c: Don’t include termhooks.h, commands.h, dispextern.h, composite.h. * src/region-cache.c: Don’t include character.h. * src/scroll.c: Don’t include keyboard.h, window.h. * src/search.c: Don’t include category.h, commands.h. * src/sound.c: Don’t include dispextern.h. * src/syntax.c: Don’t include command.h, keymap.h. * src/sysdep.c: Don’t include window.h, dispextern.h. * src/systime.h: Use ‘#ifdef emacs’, not ‘#ifdef EMACS_LISP_H’, * src/term.c: Don’t include systty.h, intervals.h, xterm.h. * src/terminal.c: Include character.h. Don’t include charset.h, coding.h. * src/textprop.c: Don’t include character.h. * src/undo.c: Don’t include character.h, commands.h, window.h. * src/unexsol.c: Don’t include character.h, charset.h. * src/widget.c: Include widget.h. Don’t include keyboard.h, window.h, dispextern.h, blockinput.h, character.h, font.h. * src/widgetprv.h: Don’t include widget.h. * src/window.c: Don’t include character.h, menu.h, intervals.h. * src/xdisp.c: Include composite.h, systime.h. Don’t include macros.h, process.h. * src/xfaces.c: Don’t include charset.h, keyboard.h, termhooks.h, intervals.h. * src/xfns.c: Don’t include menu.h, character.h, intervals.h, epaths.h, fontset.h, systime.h, atimer.h, termchar.h. * src/xfont.c: Don’t include dispextern.h, fontset.h, ccl.h. * src/xftfont.c: Don’t include dispextern.h, character.h, fontset.h. * src/xgselect.c: Don’t include timespec.h, frame.h. Include systime.h. * src/xgselect.h: Don’t include time.h. Use a forward decl to struct timespec instead. * src/xmenu.c: Don’t include keymap.h, character.h, charset.h, dispextern.h. Include systime.h. * src/xml.c: Don’t include character.h. * src/xrdb.c [USE_MOTIF]: Don’t include keyboard.h. * src/xselect.c: Don’t include dispextern.h, character.h, buffer.h, process.h. * src/xsmfns.c: Don’t include systime.h, sysselect.h. * src/xterm.c: Don’t include syssignal.h, charset.h, disptab.h, intervals.h process.h, keymap.h, xgselect.h. Include composite.h.
* Omit unnecessary \ before paren in C docstringsPaul Eggert2015-09-161-1/+1
| | | | | | | | | Although \( is needed in docstrings in Elisp code, it is not needed in docstrings in C code, since C function definitiions do not start with a parenthesis. The backslashes made the docstrings a bit harder to read and to format in columns. Also, some C docstrings had ( in column 1 and this did not appear to be causing any problems. So, simplify C docstrings by replacing \( with ( and \) with ).
* Assume GC_MARK_STACK == GC_MAKE_GCPROS_NOOPSPaul Eggert2015-08-261-11/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This removes the need for GCPRO1 etc. Suggested by Stefan Monnier in: http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00918.html * doc/lispref/internals.texi (Writing Emacs Primitives): * etc/NEWS: Document the change. * src/alloc.c (gcprolist, dump_zombies, MAX_ZOMBIES, zombies) (nzombies, ngcs, avg_zombies, max_live, max_zombies, avg_live) (Fgc_status, check_gcpros, relocatable_string_data_p, gc-precise): * src/bytecode.c (mark_byte_stack) [BYTE_MARK_STACK]: * src/eval.c (gcpro_level) [DEBUG_GCPRO]: * src/lisp.h (struct handler.gcpro, struct gcpro, GC_MARK_STACK) (GC_USE_GCPROS_AS_BEFORE, GC_MAKE_GCPROS_NOOPS) (GC_MARK_STACK_CHECK_GCPROS, GC_USE_GCPROS_CHECK_ZOMBIES) (BYTE_MARK_STACK, GCPRO1, GCPRO2, GCPRO3, GCPRO4, GCPRO5, GCPRO6) (GCPRO7, UNGCPRO, RETURN_UNGCPRO): Remove. All uses removed. The code now assumes GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS. * src/bytecode.c (relocate_byte_stack): Rename from unmark_byte_stack, since it now only relocates. All callers changed. * src/frame.c (make_frame): Add an IF_LINT to pacify GCC 5.2 with GCPROs removed. * src/systime.h: Use EMACS_LISP_H as the canary instead of GCPRO1. * test/automated/finalizer-tests.el (finalizer-basic) (finalizer-circular-reference, finalizer-cross-reference) (finalizer-error): * test/automated/generator-tests.el (cps-test-iter-close-finalizer): Remove tests, as they depend on gc-precise.
* Count MANY function args more reliablyPaul Eggert2015-01-251-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* Compute C decls for DEFSYMs automaticallyPaul Eggert2015-01-051-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Use AUTO_CONS instead of SCOPED_CONS, etc.Paul Eggert2014-09-301-2/+2
| | | | | | | | | | | | | | | | | | | * 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.
* Simplify stack-allocated Lisp objects, and make them more portable.Paul Eggert2014-09-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Keep stack-allocated Lisp objects fast rather than versatile.Dmitry Antipov2014-09-291-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* Fix local_cons etc. to not exhaust the stack when in a loop.Paul Eggert2014-09-241-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* * chartab.c (uniprop_encode_value_numeric):Dmitry Antipov2014-09-241-7/+2
| | | | | | * font.c (font_style_to_value): Use make_local_vector. (font_delete_unmatched): Use local_cons but respect MAX_ALLOCA. * keymap.c (append_key): Use scoped_list1.
* If USE_LOCAL_ALLOCATORS, allocate some Lisp objects on stack.Dmitry Antipov2014-09-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* * chartab.c (char_table_translate): Move to...Dmitry Antipov2014-07-081-13/+0
| | | | | | | * character.h (char_table_translate): ... inline function here. Avoid Faref and assume that args are always valid. This helps to speedup search, which is especially important for a huge buffers. * lisp.h (char_table_translate): Remove prototype.
* Shrink Lisp_Sub_Char_Table by preferring C integers to Lisp_Objects.Dmitry Antipov2014-07-021-30/+17
| | | | | | | | | | | | | | | | | * lisp.h (struct Lisp_Sub_Char_Table): Use C integers for depth and min_char slots. Adjust comment. (enum char_table_specials): Rename from CHAR_TABLE_STANDARD_SLOTS. Add SUB_CHAR_TABLE_OFFSET member. (make_uninit_sub_char_table): New function. * alloc.c (mark_char_table): Add extra argument to denote char table subtype. Adjust to match new layout of sub char-table. (mark_object): Always mark sub char-tables with mark_char_table. * chartab.c (make_sub_char_table, copy_sub_char_table) (sub_char_table_ref, sub_char_table_ref_and_range, sub_char_table_set) (sub_char_table_set_range, optimize_sub_char_table, map_sub_char_table) (map_sub_char_table_for_charset, uniprop_table_uncompress): All related users changed. * lread.c (read1): Adjust to match new layout of sub char-table.
* Rename EARRAYSIZE to ARRAYELTSDaniel Colascione2014-04-031-2/+2
|
* Clean up array size calculationsDaniel Colascione2014-04-031-6/+2
|
* Spelling and punctuation fixes.Paul Eggert2013-12-011-1/+1
|
* * chartab.c (make_sub_char_table): Fix size typo.Paul Eggert2013-11-071-1/+2
| | | | | | | | This bug was introduced in my 2013-06-21 change, and caused struct Lisp_Sub_Char_Table objects to be given too many slots, which broke 'make -C admin/unidata'. Fixes: debbugs:15825
* Port to stricter C99 platforms.Paul Eggert2013-11-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Especially, C99 prohibits nesting a struct X inside struct Y if struct X has a flexible array member. Also, merge from gnulib, incorporating: 2013-11-03 intprops: port to Oracle Studio c99 * lib/intprops.h: Update from gnulib. * src/alloc.c (struct sdata): New type. (sdata): Implement in terms of struct sdata. Remove u member; all uses replaced by next_vector, set_next_vector. (SDATA_SELECTOR, SDATA_DATA, SDATA_DATA_OFFSET): Adjust to sdata change. (SDATA_DATA_OFFSET): Now a constant, not a macro. (struct sblock): Rename first_data member to data, which is now a flexible array member. All uses changed. (next_vector, set_next_vector, large_vector_vec): New functions. (vector_alignment): New constant. (roundup_size): Make it a multiple of ALIGNOF_STRUCT_LISP_VECTOR, too. (struct large-vector): Now merely a NEXT member, since the old approach ran afoul of stricter C99. All uses changed to use large_vector_vec or large_vector_offset. (large_vector_offset): New constant. * src/dispnew.c: Include tparam.h, for tgetent. Do not include term.h; no longer needed. * src/gnutls.c (Fgnutls_boot): Don't continue after calling a _Noreturn. * src/lisp.h (ENUM_BF) [__SUNPRO_C && __STDC__]: Use unsigned int. (struct Lisp_Vector): Use a flexible array member for contents, instead of a union with a member that is an array of size 1. All uses changed. (ALIGNOF_STRUCT_LISP_VECTOR): New constant, to make up for the fact that the struct no longer contains a union. (struct Lisp_Misc_Any, struct Lisp_Marker, struct Lisp_Overlay) (struct Lisp_Save_Value, struct Lisp_Free): Use unsigned, not int, for spacers, to avoid c99 warning. (union specbinding): Use unsigned, not bool, for bitfield, as bool is not portable to pre-C99 hosts.
* Use union for the payload of struct Lisp_Vector.Dmitry Antipov2013-09-241-2/+2
| | | | | | | | | | | | This helps to avoid a few glitches dictated by C's aliasing rules. * lisp.h (struct Lisp_Vector): Use union for next and contents member. Adjust comment. Change related users. * alloc.c (next_in_free_list, set_next_in_free_list): Remove. Related users changed. * buffer.c, bytecode.c, ccl.c, character.h, chartab.c, composite.c: * composite.h, disptab.h, fns.c, fontset.c, indent.c, keyboard.c: * lread.c, msdos.c, process.c, w32menu.c, window.c, xdisp.c: * xfaces.c, xfont.c, xmenu.c: Related users changed.
* Use C99-style flexible array members if available.Paul Eggert2013-06-211-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This avoids some subtle aliasing issues, which typically aren't a problem with GCC but may be a problem elsewhere. * lib-src/ebrowse.c (struct member, struct alias, struct sym): Use FLEXIBLE_ARRAY_MEMBER. (add_sym, add_member, make_namespace, register_namespace_alias): Use offsetof (struct, flex_array_member), not sizeof (struct), as that ports better to pre-C99 non-GCC. * src/alloc.c (sdata): New typedef, replacing the old struct sdata. It is a struct if GC_CHECK_STRING_BYTES, a union otherwise. In either case, it uses a flexible array member rather than the old struct hack. All uses changed. (SDATA_NBYTES, sweep_strings) [!GC_CHECK_STRING_BYTES]: Adjust to sdata reorganization. * src/alloc.c (VBLOCK_BYTES_MIN, allocate_vectorlike, Fgarbage_collect): Use offsetof (struct, flex_array_member), not sizeof (struct), as that ports better to pre-C99 non-GCC. * src/chartab.c (Fmake_char_table, make_sub_char_table, copy_char_table): Use CHAR_TABLE_STANDARD_SLOTS rather than its definition, as the latter has changed. * src/conf_post.h (FLEXIBLE_ARRAY_MEMBER): Move here from w32.c, and port better to pre-C99 GCC. * src/image.c (struct xpm_cached_color): * src/lisp.h (struct Lisp_Vector, struct Lisp_Bool_Vector) (struct Lisp_Char_Table, struct Lisp_Sub_Char_Table): Use FLEXIBLE_ARRAY_MEMBER. * src/lisp.h (string_bytes) [GC_CHECK_STRING_BYTES]: Move decl to top level so it gets checked against implementation. (CHAR_TABLE_STANDARD_SLOTS): Adjust to struct Lisp_Char_Table change. * src/w32.c (FLEXIBLE_ARRAY_MEMBER): Move to conf_post.h.
* Use functions, not macros, for XINT etc.Paul Eggert2013-06-161-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Remove several obsolete vars and functions unlikely to be still in use.Chong Yidong2012-09-241-10/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/vc/log-edit.el (cvs-changelog-full-paragraphs) (cvs-commit-buffer-require-final-newline): Obsolete variables removed. * lisp/font-lock.el (font-lock-reference-face): Use define-obsolete-variable-alias. * lisp/international/mule.el (set-char-table-default): Remove. (set-coding-priority, make-coding-system, generic-char-p) (charset-list, charset-bytes, charset-id): Use declare to mark obsolete. * lisp/mail/supercite.el (sc-version): Remove obsolete function. (sc-describe): Don't mark as obsolete, since it is bound. (sc-submit-bug-report): Remove. * lisp/progmodes/compile.el (compile-internal): Remove obsolete function. (compilation-parse-errors-function): Fix typo. * lisp/vc/emerge.el (emerge-mode): Make it an obsolete alias. (emerge-version): Remove. * lisp/vc/pcvs-defs.el (cvs-buffer-name-alist) (cvs-invert-ignore-marks): Remove references to obsolete vars. * lisp/vc/vc-hooks.el (vc-default-registered): Don't use vc-master-templates. * lisp/vc/pcvs-defs.el (cvs-diff-buffer-name, cvs-diff-ignore-marks) * lisp/vc/vc-hooks.el (vc-ignore-vc-files, vc-master-templates) * lisp/vc/vc.el (vc-checkout-carefully): Likewise. * src/chartab.c (Fset_char_table_default): Obsolete function removed.
* Port better to POSIX hosts lacking _setjmp.Paul Eggert2012-09-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | * configure.ac (HAVE__SETJMP, HAVE_SIGSETJMP): New symbols. (_setjmp, _longjmp): Remove. * src/lisp.h: Include <setjmp.h> here, since we use its symbols here. All instances of '#include <setjmp.h>' removed, if the only reason for the instance was because "lisp.h" was included. (sys_jmp_buf, sys_setjmp, sys_longjmp): New symbols. Unless otherwise specified, replace all uses of jmp_buf, _setjmp, and _longjmp with the new symbols. Emacs already uses _setjmp if available, so this change affects only POSIXish hosts that have sigsetjmp but not _setjmp, such as some versions of Solaris and Unixware. (Also, POSIX-2008 marks _setjmp as obsolescent.) * src/image.c (_setjmp, _longjmp) [HAVE_PNG && !HAVE__SETJMP]: New macros. (png_load_body) [HAVE_PNG]: (PNG_LONGJMP) [HAVE_PNG && PNG_LIBPNG_VER < 10500]: (PNG_JMPBUF) [HAVE_PNG && PNG_LIBPNG_VER >= 10500]: Use _setjmp and _longjmp rather than sys_setjmp and sys_longjmp, since PNG requires jmp_buf. This is the only exception to the general rule that we now use sys_setjmp and sys_longjmp. This exception is OK since this code does not change the signal mask or longjmp out of a signal handler. Fixes: debbugs:12446
* * character.c, charset.c, chartab.c: Use bool for booleans.Paul Eggert2012-08-261-9/+10
| | | | | | | | | | | | | | | | | | | | | | * character.c (lisp_string_width, string_count_byte8) (string_escape_byte8): * charset.c (charset_map_loaded, load_charset_map, read_hex): (load_charset_map_from_file, map_charset_chars) (Fdefine_charset_internal, define_charset_internal) (Fdeclare_equiv_charset, find_charsets_in_text) (Ffind_charset_region, char_charset, Fiso_charset): * chartab.c (sub_char_table_ref, sub_char_table_ref_and_range) (sub_char_table_set, sub_char_table_set_range) (char_table_set_range, optimize_sub_char_table) (map_sub_char_table): Use bool for boolean. * character.c (str_to_unibyte): Omit last boolean argument; it was always 0. All callers changed. * character.h, charset.h: Adjust to match previous changes. * character.h (char_printable_p): Remove decl of nonexistent function. * charset.h (struct charset): Members code_linear_p, iso_chars_96, ascii_compatible_p, supplementary_p, compact_codes_p, unified_p are all boolean, so make them single-bit bitfields.
* port new setting code to Sun C 5.8 2005/10/13Paul Eggert2012-08-181-4/+2
| | | | | | | | * chartab.c, lisp.h (char_table_set, char_table_set_range): Return void, not Lisp_Object. Otherwise, the compiler complains about (A?B:C) where B is void and C is Lisp_Object when compiling CHAR_TABLE_SET, due to the recent change to the API of sub_char_table_set_contents.
* * lisp.h (set_char_table_extras): Rename from char_table_set_extras.Paul Eggert2012-08-171-27/+23
| | | | | | | (set_char_table_contents): Rename from char_table_set_contents. (set_sub_char_table_contents): Rename from sub_char_table_sub_contents. All uses changed. See the end of <http://lists.gnu.org/archive/html/emacs-devel/2012-08/msg00549.html>.
* * lisp.h (CSET): Remove.Paul Eggert2012-08-171-18/+18
| | | | | | | | | | | | (set_char_table_ascii, set_char_table_defalt, set_char_table_parent) (set_char_table_purpose): New functions, replacing CSET. All uses changed. For example, replace "CSET (XCHAR_TABLE (char_table), parent, parent);" with "char_table_set_parent (char_table, parent);". The old version was confusing because it used the same name 'parent' for two different things. Fixes: debbugs:12215
* Fix previous char table change.Dmitry Antipov2012-08-161-4/+8
| | | | | * lisp.h (CHAR_TABLE_SET): Use sub_char_table_set_contents. * chartab.c (optimize_sub_char_table): Likewise.
* Simple interface to set Lisp_Object fields of chararcter tables.Dmitry Antipov2012-08-161-43/+43
| | | | | | | | * lisp.h (CSET): New macro. (char_table_set_extras, char_table_set_contents) (sub_char_table_set_contents): New function. * casetab.c, category.c, chartab.c, fns.c, fontset.c, search.c: * syntax.c: Adjust users.
* Doc fixes.Chong Yidong2012-08-151-5/+5
| | | | | | | | | | * lisp/emacs-lisp/regexp-opt.el (regexp-opt-charset): Doc fix. * src/chartab.c (Fmap_char_table): Doc fix. * src/editfns.c (Fformat): Doc fix. Fixes: debbugs:12059 debbugs:12085 debbugs:12061
* Merge from trunk.Paul Eggert2011-12-101-1/+1
|\
| * Spelling fixes.Paul Eggert2011-11-191-1/+1
| |
* | Merge from trunk.Paul Eggert2011-11-181-2/+2
|\ \ | |/
| * Spelling fixes.Paul Eggert2011-11-171-1/+1
| |
| * Fix typos.Juanma Barranquero2011-11-141-1/+1
| |
* | * alloc.c (pure_bytes_used_lisp, pure_bytes_used_non_lisp):Paul Eggert2011-09-211-5/+5
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (allocate_vectorlike, buffer_memory_full, struct sdata, SDATA_SIZE) (string_bytes, check_sblock, allocate_string_data): (compact_small_strings, Fmake_bool_vector, make_string) (make_unibyte_string, make_multibyte_string) (make_string_from_bytes, make_specified_string) (allocate_vectorlike, Fmake_vector, find_string_data_in_pure) (make_pure_string, make_pure_c_string, make_pure_vector, Fpurecopy) (mark_vectorlike): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. (allocate_pseudovector): Use int, not EMACS_INT, where int is wide enough. (inhibit_garbage_collection, Fgarbage_collect): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. * bidi.c (bidi_mirror_char): Use EMACS_INT, not int, where int might not be wide enough. (bidi_cache_search, bidi_cache_find, bidi_init_it) (bidi_count_bytes, bidi_char_at_pos, bidi_fetch_char) (bidi_at_paragraph_end, bidi_find_paragraph_start) (bidi_paragraph_init, bidi_resolve_explicit, bidi_resolve_weak) (bidi_level_of_next_char, bidi_move_to_visually_next): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. * buffer.c (copy_overlays, Fgenerate_new_buffer_name) (Fkill_buffer, Fset_buffer_major_mode) (advance_to_char_boundary, Fbuffer_swap_text) (Fset_buffer_multibyte, overlays_at, overlays_in) (overlay_touches_p, struct sortvec, record_overlay_string) (overlay_strings, recenter_overlay_lists) (adjust_overlays_for_insert, adjust_overlays_for_delete) (fix_start_end_in_overlays, fix_overlays_before, modify_overlay) (Fmove_overlay, Fnext_overlay_change, Fprevious_overlay_change) (Foverlay_recenter, last_overlay_modification_hooks_used) (report_overlay_modification, evaporate_overlays, enlarge_buffer_text): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. (validate_region): Omit unnecessary test for b <= e, since that's guaranteed by the previous test. (adjust_overlays_for_delete): Avoid pos + length overflow. (Fmove_overlay, Fdelete_overlay, add_overlay_mod_hooklist) (report_overlay_modification): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. (Foverlays_at, Fnext_overlay_change, Fprevious_overlay_change): Omit pointer cast, which isn't needed anyway, and doesn't work after the EMACS_INT -> ptrdiff_t change. * buffer.h: Adjust decls to match defn changes elsewhere. (struct buffer_text, struct buffer): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. Use EMACS_INT, not int, where int might not be wide enough. * bytecode.c (exec_byte_code): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. Remove unnecessary memory-full test. Use EMACS_INT, not ptrdiff_t or int, where ptrdiff_t or int might not be wide enough. * callint.c (Fcall_interactively): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. * callproc.c (call_process_kill, Fcall_process): Don't assume pid_t fits into an Emacs fixnum. (call_process_cleanup, Fcall_process, child_setup): Don't assume pid_t fits into int. (call_process_cleanup, Fcall_process, delete_temp_file) (Fcall_process_region): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. (Fcall_process): Simplify handling of volatile integers. Use int, not EMACS_INT, where int will do. * casefiddle.c (casify_object, casify_region, operate_on_word) (Fupcase_word, Fdowncase_word, Fcapitalize_word): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. (casify_object): Avoid integer overflow when overallocating buffer. * casetab.c (set_identity, shuffle): Prefer int to unsigned when either works. * category.c (Fchar_category_set): Don't assume fixnum fits in int. * category.h (CATEGORYP): Don't assume arg is nonnegative. * ccl.c (GET_CCL_INT): Remove; no longer needed, since the integers are now checked earlier. All uses replaced with XINT. (ccl_driver): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. For CCL_MapSingle, check that content and value are in int range. (resolve_symbol_ccl_program): Check that vector header is in range. Always copy the vector, so that we can check its contents reliably now rather than having to recheck each instruction as it's being executed. Check that vector words fit in 'int'. (ccl_get_compiled_code, Fregister_ccl_program) (Fregister_code_conversion_map): Use ptrdiff_t, not int, for program indexes, to avoid needless 32-bit limit on 64-bit hosts. (Fccl_execute, Fccl_execute_on_string): Check that initial reg contents are in range. (Fccl_execute_on_string): Check that status is in range. * ccl.h (struct ccl_program.idx): Now ptrdiff_t, not int. * character.c (char_resolve_modifier_mask, Fchar_resolve_modifiers): Accept and return EMACS_INT, not int, because callers can pass values out of 'int' range. (c_string_width, strwidth, lisp_string_width, chars_in_text) (multibyte_chars_in_text, parse_str_as_multibyte) (str_as_multibyte, count_size_as_multibyte, str_to_multibyte) (str_as_unibyte, str_to_unibyte, string_count_byte8) (string_escape_byte8, Fget_byte): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. (Funibyte_string): Use CHECK_CHARACTER, not CHECK_NATNUM, to avoid mishandling large integers. * character.h: Adjust decls to match defn changes elsewhere. * charset.c (load_charset_map_from_file, find_charsets_in_text) (Ffind_charset_region): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. (load_charset_map_from_file): Redo idx calculation to avoid overflow. (load_charset_map_from_vector, Fdefine_charset_internal): Don't assume fixnum fits in int or unsigned int. (load_charset_map_from_vector, Fmap_charset_chars): Remove now-unnecessary CHECK_NATNUMs. (Fdefine_charset_internal): Check ranges here, more carefully. * chartab.c (Fmake_char_table, Fset_char_table_range) (uniprop_get_decoder, uniprop_get_encoder): Don't assume fixnum fits in int. * cmds.c (move_point): New function, that does the gist of Fforward_char and Fbackward_char, but does so while checking for integer overflow more accurately. (Fforward_char, Fbackward_char, internal_self_insert): Use it. (Fforward_line, Fend_of_line, internal_self_insert) (internal_self_insert): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. Fix a FIXME, by checking for integer overflow when calculating target_clm and actual_clm. * coding.c (detect_coding_XXX, encode_coding_XXX, CODING_DECODE_CHAR) (ASSURE_DESTINATION, coding_alloc_by_realloc) (coding_alloc_by_making_gap, alloc_destination) (detect_coding_utf_8, encode_coding_utf_8, decode_coding_utf_16) (encode_coding_utf_16, detect_coding_emacs_mule) (decode_coding_emacs_mule, encode_coding_emacs_mule) (detect_coding_iso_2022, decode_coding_iso_2022) (encode_invocation_designation, encode_designation_at_bol) (encode_coding_iso_2022, detect_coding_sjis, detect_coding_big5) (decode_coding_sjis, decode_coding_big5, encode_coding_sjis) (encode_coding_big5, detect_coding_ccl, decode_coding_ccl) (encode_coding_ccl, encode_coding_raw_text) (detect_coding_charset, decode_coding_charset) (encode_coding_charset, detect_eol, decode_eol, produce_chars) (produce_composition, produce_charset, produce_annotation) (decode_coding, handle_composition_annotation) (handle_charset_annotation, consume_chars, decode_coding_gap) (decode_coding_object, encode_coding_object, detect_coding_system) (Ffind_coding_systems_region_internal, Fcheck_coding_systems_region) (code_convert_region, code_convert_string) (Fdefine_coding_system_internal): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. (setup_iso_safe_charsets, consume_chars, Funencodable_char_position) (Fdefine_coding_system_internal): Don't assume fixnums fit in int. (decode_coding_gap, decode_coding_object, encode_coding_object) (Fread_coding_system, Fdetect_coding_region, Funencodable_char_position) (Fcheck_coding_systems_region): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. (Ffind_operation_coding_system): NATNUMP can eval its arg twice. (Fdefine_coding_system_internal): Check for charset-id overflow. * coding.h: Adjust decls to match defn changes elsewhere. (struct coding_system): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. * composite.c (get_composition_id, find_composition) (run_composition_function, update_compositions) (compose_text, composition_gstring_put_cache) (composition_gstring_p, composition_gstring_width) (fill_gstring_header, fill_gstring_body, autocmp_chars) (composition_compute_stop_pos, composition_reseat_it) (composition_update_it, struct position_record) (find_automatic_composition, composition_adjust_point) (Fcomposition_get_gstring, Ffind_composition_internal): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. (update_compositions): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. * composite.h: Adjust decls to match defn changes elsewhere. (struct composition): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. * data.c (let_shadows_buffer_binding_p, let_shadows_global_binding_p): Do not attempt to compute the address of the object just before a buffer; this is not portable. (Faref, Faset): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. (Faset): Use int, not EMACS_INT, where int is wide enough. (Fstring_to_number): Don't assume fixnums fit in int. (Frem): Don't assume arg is nonnegative. * dbusbind.c (xd_append_arg): Check for integers out of range. (Fdbus_call_method): Don't overflow the timeout int. * dired.c (directory_files_internal, file_name_completion, scmp) (file_name_completion_stat): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. (file_name_completion): Don't overflow matchcount. (file_name_completion_stat): Use SAFE_ALLOCA, not alloca. * dispextern.h: Adjust decls to match defn changes elsewhere. (struct text_pos, struct glyph, struct bidi_saved_info) (struct bidi_string_data, struct bidi_it, struct composition_it) (struct it): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. (struct display_pos, struct composition_it, struct it): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. * dispnew.c (increment_matrix_positions) (increment_row_positions, mode_line_string) (marginal_area_string): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. (change_frame_size_1, Fredisplay): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. (duration_to_sec_usec): New function, to check for overflow better. (Fsleep_for, sit_for): Use it. * doc.c (get_doc_string, store_function_docstring): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. (get_doc_string, Fsnarf_documentation): Use int, not EMACS_INT, where int is wide enough. (get_doc_string): Use SAFE_ALLOCA, not alloca. Check for overflow when converting EMACS_INT to off_t. * doprnt.c (doprnt): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. * editfns.c (init_editfns, Fuser_uid, Fuser_real_uid): Don't assume uid_t fits into fixnum. (buildmark, Fgoto_char, overlays_around, find_field, Fdelete_field) (Ffield_string, Ffield_string_no_properties, Ffield_beginning) (Ffield_end, Fconstrain_to_field, Fline_beginning_position) (Fline_end_position, Fprevious_char, Fchar_after, Fchar_before) (general_insert_function) (Finsert_char, make_buffer_string, make_buffer_string_both) (update_buffer_properties, Fbuffer_substring) (Fbuffer_substring_no_properties, Fcompare_buffer_substrings) (Fsubst_char_in_region, check_translation) (Ftranslate_region_internal, save_restriction_restore, Fformat) (transpose_markers, Ftranspose_regions): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. (clip_to_bounds): Move to lisp.h as an inline function). (Fconstrain_to_field): Don't assume integers are nonnegative. (Fline_beginning_position, Fsave_excursion, Fsave_current_buffer): (Fsubst_char_in_region, Fsave_restriction): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. (Femacs_pid): Don't assume pid_t fits into fixnum. (lo_time): Use int, not EMACS_INT, when int suffices. (lisp_time_argument): Check for usec out of range. (Fencode_time): Don't assume fixnum fits in int. * emacs.c (gdb_valbits, gdb_gctypebits): Now int, not EMACS_INT. (gdb_data_seg_bits): Now uintptr_t, not EMACS_INT. (PVEC_FLAG, gdb_array_mark_flag): Now ptrdiff_t, not EMACS_INT. (init_cmdargs, Fdump_emacs): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. (Fkill_emacs): Don't assume fixnum fits in int; instead, take just the bottom (typically) 32 bits of the fixnum. * eval.c (specpdl_size, call_debugger): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. (when_entered_debugger, Fbacktrace_debug): Don't assume fixnum can fit in int. (Fdefvaralias, Fdefvar): Do not attempt to compute the address of the object just before a buffer; this is not portable. (FletX, Flet, Funwind_protect, do_autoload, Feval, funcall_lambda) (grow_specpdl, unbind_to): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. (Fapply, apply_lambda): Don't assume ptrdiff_t can hold fixnum. (grow_specpdl): Simplify allocation by using xpalloc. * fileio.c (Ffind_file_name_handler, Fcopy_file, Frename_file) (Finsert_file_contents, Fwrite_region, Fdo_auto_save): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. (Ffind_file_name_handler, non_regular_inserted, Finsert_file_contents) (a_write, e_write): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. (Fcopy_file, non_regular_nbytes, read_non_regular) (Finsert_file_contents): Use int, not EMACS_INT, where int is wide enough. (READ_BUF_SIZE): Verify that it fits in int. (Finsert_file_contents): Check that counts are in proper range, rather than assuming fixnums fit into ptrdiff_t etc. Don't assume fixnums fit into int. (Fdo_auto_save, Fset_buffer_auto_saved) (Fclear_buffer_auto_save_failure): Don't assume time_t is signed, or that it fits in int. * fns.c (Fcompare_strings, Fstring_lessp, struct textprop_rec) (concat, string_char_byte_cache_charpos, string_char_byte_cache_bytepos) (string_char_to_byte, string_byte_to_char) (string_make_multibyte, string_to_multibyte) (string_make_unibyte, Fstring_as_unibyte, Fstring_as_multibyte) (Fstring_to_unibyte, Fsubstring, Fsubstring_no_properties) (substring_both, Fdelete, internal_equal, Ffillarray) (Fclear_string, mapcar1) (Fbase64_encode_region, Fbase64_encode_string, base64_encode_1) (Fbase64_decode_region, Fbase64_decode_string, base64_decode_1) (larger_vector, make_hash_table, maybe_resize_hash_table) (hash_lookup, hash_remove_from_table, hash_clear, sweep_weak_table) (Fmaphash, secure_hash): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. (concat): Check for string index and length overflow. (Fmapconcat): Don't assume fixnums fit into ptrdiff_t. (Frequire): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. (larger_vector): New API (vec, incr_min, size_max) replaces old one (vec, new_size, init). This catches size overflow. INIT was removed because it was always Qnil. All callers changed. (INDEX_SIZE_BOUND): New macro, which calculates more precisely the upper bound on a hash table index size. (make_hash_table, maybe_resize_hash_table): Use it. (secure_hash): Computer start_byte and end_byte only after they're known to be in ptrdiff_t range. * font.c (font_intern_prop, font_at, font_range, Ffont_shape_gstring) (Ffont_get_glyphs, Ffont_at): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. (font_style_to_value, font_prop_validate_style, font_expand_wildcards) (Flist_fonts, Fopen_font): Don't assume fixnum can fit in int. (check_gstring): Don't assume index can fit in int. (font_match_p): Check that fixnum is a character, not a nonnegative fixnum, since the later code needs to stuff it into an int. (font_find_for_lface): Use SAFE_ALLOCA_LISP, not alloca. (font_fill_lglyph_metrics): Use unsigned, not EMACS_INT, to avoid conversion overflow issues. (Fopen_font): Check for integer out of range. (Ffont_get_glyphs): Don't assume index can fit in int. * font.h: Adjust decls to match defn changes elsewhere. * fontset.c (reorder_font_vector): Redo score calculation to avoid integer overflow. (num_auto_fontsets, fontset_from_font): Use ptrdiff_t, not printmax_t, where ptrdiff_t is wide enough. (Finternal_char_font): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. * frame.c (Fset_mouse_position, Fset_mouse_pixel_position) (Fset_frame_height, Fset_frame_width, Fset_frame_size) (Fset_frame_position, x_set_frame_parameters) (x_set_line_spacing, x_set_border_width) (x_set_internal_border_width, x_set_alpha, x_figure_window_size): Check that fixnums are in proper range for system types. (frame_name_fnn_p, Fframe_parameter, Fmodify_frame_parameters): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. (Fmodify_frame_parameters): Don't assume fixnum fits in int. Use SAFE_ALLOCA_LISP, not alloca. * frame.h (struct frame): Use intptr_t, not EMACS_INT, where intptr_t is wide enough. * fringe.c (lookup_fringe_bitmap, get_logical_fringe_bitmap) (Fdefine_fringe_bitmap): Don't assume fixnum fits in int. (Ffringe_bitmaps_at_pos): Don't assume index fits in int. Check for fixnum out of range. * ftfont.c (ftfont_list): Don't assume index fits in int. Check that fixnums are in proper range for system types. (ftfont_shape_by_flt): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. Remove no-longer-needed lint_assume. * gnutls.c (emacs_gnutls_write, emacs_gnutls_read): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. (Fgnutls_error_fatalp, Fgnutls_error_string, Fgnutls_boot): Check that fixnums are in proper range for system types. * gnutls.h: Adjust decls to match defn changes elsewhere. * gtkutil.c (xg_dialog_run): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. (update_frame_tool_bar): Check that fixnums are in proper range for system types. * image.c (parse_image_spec): Redo count calculation to avoid overflow. (lookup_image): Check that fixnums are in proper range for system types. * indent.c (last_known_column, last_known_column_point): (current_column_bol_cache): (skip_invisible, current_column, check_display_width): (check_display_width, scan_for_column, current_column_1) (Findent_to, Fcurrent_indentation, position_indentation) (indented_beyond_p, Fmove_to_column, compute_motion): (Fcompute_motion, Fvertical_motion): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. (last_known_column_modified): Use EMACS_INT, not int. (check_display_width): (Fcompute_motion): Check that fixnums and floats are in proper range for system types. (compute_motion): Don't assume index or fixnum fits in int. (compute_motion, Fcompute_motion): Use int, not EMACS_INT, when it is wide enough. (vmotion): Omit local var start_hpos that is always 0; that way we don't need to worry about overflow in expressions involving it. * indent.h: Adjust decls to match defn changes elsewhere. (struct position): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. Use int, not EMACS_INT, where int is wide enough. Remove unused members ovstring_chars_done and tab_offset; all uses removed. * insdel.c (move_gap, move_gap_both, gap_left, gap_right) (adjust_markers_for_delete, adjust_markers_for_insert, adjust_point) (adjust_markers_for_replace, make_gap_larger, make_gap_smaller) (make_gap, copy_text, insert, insert_and_inherit) (insert_before_markers, insert_before_markers_and_inherit) (insert_1, count_combining_before, count_combining_after) (insert_1_both, insert_from_string) (insert_from_string_before_markers, insert_from_string_1) (insert_from_gap, insert_from_buffer, insert_from_buffer_1) (adjust_after_replace, adjust_after_insert, replace_range) (replace_range_2, del_range, del_range_1, del_range_byte) (del_range_both, del_range_2, modify_region) (prepare_to_modify_buffer, signal_before_change) (signal_after_change, Fcombine_after_change_execute): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. * intervals.c (traverse_intervals, rotate_right, rotate_left) (balance_an_interval, split_interval_right, split_interval_left) (find_interval, next_interval, update_interval) (adjust_intervals_for_insertion, delete_node, delete_interval) (interval_deletion_adjustment, adjust_intervals_for_deletion) (static_offset_intervals, offset_intervals) (merge_interval_right, merge_interval_left, make_new_interval) (graft_intervals_into_buffer, temp_set_point_both) (temp_set_point, set_point, adjust_for_invis_intang) (set_point_both, move_if_not_intangible, get_property_and_range) (get_local_map, copy_intervals, copy_intervals_to_string) (compare_string_intervals, set_intervals_multibyte_1): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. * intervals.h: Adjust decls to match defn changes elsewhere. (struct interval): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. * keyboard.c (this_command_key_count, this_single_command_key_start) (before_command_key_count, before_command_echo_length, echo_now) (echo_length, recursive_edit_1, Frecursive_edit, Ftrack_mouse) (command_loop_1, safe_run_hooks, read_char, timer_check_2) (menu_item_eval_property, read_key_sequence, Fread_key_sequence) (Fread_key_sequence_vector, Fexecute_extended_command, Fsuspend_emacs): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. (last_non_minibuf_size, last_point_position, echo_truncate) (command_loop_1, adjust_point_for_property, read_char, gen_help_event) (make_lispy_position, make_lispy_event, parse_modifiers_uncached) (parse_modifiers, modify_event_symbol, Fexecute_extended_command) (stuff_buffered_input): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. (last_auto_save, command_loop_1, read_char): Use EMACS_INT, not int, to avoid integer overflow. (record_char): Avoid overflow in total_keys computation. (parse_modifiers_uncached): Redo index calculation to avoid overflow. * keyboard.h: Adjust decls to match defn changes elsewhere. * keymap.c (Fdefine_key, Fcurrent_active_maps, accessible_keymaps_1) (Fkey_description, Fdescribe_vector, Flookup_key): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. (click_position): New function, to check that positions are in range. (Fcurrent_active_maps): (describe_command): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. (Faccessible_keymaps, Fkey_description): (preferred_sequence_p): Don't assume fixnum can fit into int. (Fkey_description): Use SAFE_ALLOCA_LISP, not alloca. Check for integer overflow in size calculations. (Ftext_char_description): Use CHECK_CHARACTER, not CHECK_NUMBER, to avoid mishandling large integers. * lisp.h: Adjust decls to match defn changes elsewhere. (ARRAY_MARK_FLAG, PSEUDOVECTOR_FLAG, struct Lisp_String) (struct vectorlike_header, struct Lisp_Subr, struct Lisp_Hash_Table) (struct Lisp_Marker): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. (clip_to_bounds): Now an inline function, moved here from editfns.c. (XSETSUBR): Use size of 0 since the actual size doesn't matter, and using 0 avoids overflow. (GLYPH_CODE_P): Check for overflow in system types, subsuming the need for GLYPH_CODE_CHAR_VALID_P and doing proper checking ourselves. All callers changed. (GLYPH_CODE_CHAR, GLYPH_CODE_FACE): Assume the arg has valid form, since it always does. (TYPE_RANGED_INTEGERP): Avoid bug when checking against a wide unsigned integer system type. (CHECK_RANGED_INTEGER, CHECK_TYPE_RANGED_INTEGER): New macros. (struct catchtag, specpdl_size, SPECPDL_INDEX, USE_SAFE_ALLOCA): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. (struct catchtag): Use EMACS_INT, not int, since it may be a fixnum. (duration_to_sec_usec): New decl. * lread.c (read_from_string_index, read_from_string_index_byte) (read_from_string_limit, readchar, unreadchar, openp) (read_internal_start, read1, oblookup): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. (Fload, readevalloop, Feval_buffer, Feval_region): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. (openp): Check for out-of-range argument to 'access'. (read1): Use int, not EMACS_INT, where int is wide enough. Don't assume fixnum fits into int. * macros.c (Fstart_kbd_macro): Use xpalloc to check for overflow in size calculation. (Fexecute_kbd_macro): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. * marker.c (cached_charpos, cached_bytepos, CONSIDER) (byte_char_debug_check, buf_charpos_to_bytepos, verify_bytepos) (buf_bytepos_to_charpos, Fset_marker, set_marker_restricted) (set_marker_both, set_marker_restricted_both, marker_position) (marker_byte_position, Fbuffer_has_markers_at): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. (Fset_marker, set_marker_restricted): Don't assume fixnum fits in int. * menu.c (ensure_menu_items): Renamed from grow_menu_items. It now merely ensures that the menu is large enough, without necessarily growing it, as this avoids some integer overflow issues. All callers changed. (keymap_panes, parse_single_submenu, Fx_popup_menu): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. (parse_single_submenu, Fx_popup_menu): Don't assume fixnum fits in int. Use SAFE_ALLOCA_LISP, not alloca. (find_and_return_menu_selection): Avoid unnecessary casts of pointers to EMACS_INT. Check that fixnums are in proper range for system types. * minibuf.c (minibuf_prompt_width, string_to_object) (Fminibuffer_contents, Fminibuffer_contents_no_properties) (Fminibuffer_completion_contents, Ftry_completion, Fall_completions): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. (get_minibuffer, read_minibuf_unwind): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. (read_minibuf): Omit unnecessary arg BACKUP_N, which is always nil; this simplifies overflow checking. All callers changed. (read_minibuf, Fread_buffer, Ftry_completion, Fall_completions) (Ftest_completion): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. * nsfns.m (check_ns_display_info): Don't assume fixnum fits in long. (x_set_menu_bar_lines, x_set_tool_bar_lines, Fx_create_frame): Check that fixnums are in proper range for system types. (Fx_create_frame, Fx_show_tip): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. * nsfont.m (ns_findfonts, nsfont_list_family): Don't assume fixnum fits in long. * nsmenu.m (ns_update_menubar, ns_menu_show, ns_popup_dialog): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. (ns_update_menubar): Use intptr_t, not EMACS_INT, when intptr_t is wide enough. * nsselect.m (ns_get_local_selection): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. * print.c (print_buffer_size, print_buffer_pos, print_buffer_pos_byte) (PRINTDECLARE, PRINTPREPARE): (strout, print_string): (print, print_preprocess, print_check_string_charset_prop) (print_object): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. (PRINTDECLARE): (temp_output_buffer_setup, Fprin1_to_string, print_object): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. (PRINTPREPARE): Use int, not ptrdiff_t, where int is wide enough. (PRINTFINISH): Use SAFE_ALLOCA, not alloca. (printchar, strout): Use xpalloc to catch size calculation overflow. (Fexternal_debugging_output): Use CHECK_CHARACTER, not CHECK_NUMBER, to avoid mishandling large integers. (print_error_message): Use SAFE_ALLOCA, not alloca. (print_object): Use int, not EMACS_INT, where int is wide enough. * process.c (Fdelete_process): Don't assume pid fits into EMACS_INT. (Fset_process_window_size, Fformat_network_address) (get_lisp_to_sockaddr_size, set_socket_option, Fmake_network_process) (Fsignal_process, sigchld_handler): Check that fixnums are in proper range for system types. (Fformat_network_address, read_process_output, send_process) (Fprocess_send_region, status_notify): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. (Fformat_network_address, Fmake_serial_process, Fmake_network_process) (wait_reading_process_output, read_process_output, exec_sentinel): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. (conv_lisp_to_sockaddr): Don't assume fixnums fit into int. (Faccept_process_output): Use duration_to_sec_usec to do proper overflow checking on durations. * scroll.c (calculate_scrolling, calculate_direct_scrolling) (line_ins_del): Use int, not EMACS_INT, where int is wide enough. * search.c (looking_at_1, string_match_1): (fast_string_match, fast_c_string_match_ignore_case) (fast_string_match_ignore_case, fast_looking_at, scan_buffer) (scan_newline, find_before_next_newline, search_command) (trivial_regexp_p, search_buffer, simple_search, boyer_moore) (set_search_regs, wordify): (Freplace_match): (Fmatch_data): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. (string_match_1, search_buffer, set_search_regs): (Fmatch_data): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. (wordify): Check for overflow in size calculation. (Freplace_match): Avoid potential buffer overflow in search_regs.start. (Fset_match_data): Don't assume fixnum fits in ptrdiff_t. Check that fixnums are in proper range for system types. * sound.c (struct sound_device) (wav_play, au_play, vox_write, alsa_period_size, alsa_write): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. (Fplay_sound_internal): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. * syntax.c (ST_COMMENT_STYLE, ST_STRING_STYLE): In definitions, make it clearer that these values must be out of range for the respective integer ranges. This fixes a bug with ST_STRING_STYLE and non-ASCII characters. (struct lisp_parse_state, find_start_modiff) (Finternal_describe_syntax_value, scan_lists, scan_sexps_forward): (Fparse_partial_sexp): Don't assume fixnums can fit in int. (struct lisp_parse_state, find_start_pos, find_start_value) (find_start_value_byte, find_start_begv) (update_syntax_table, char_quoted, dec_bytepos) (find_defun_start, prev_char_comend_first, back_comment): (scan_words, skip_chars, skip_syntaxes, forw_comment, Fforward_comment) (scan_lists, Fbackward_prefix_chars, scan_sexps_forward): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. (Finternal_describe_syntax_value): Check that match_lisp is a character, not an integer, since the code stuffs it into int. (scan_words, scan_sexps_forward): Check that fixnums are in proper range for system types. (Fforward_word): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. (scan_sexps_forward): Use CHARACTERP, not INTEGERP, since the value must fit into int. (Fparse_partial_sexp): Fix doc; element 8 is not ignored. * syntax.h: Adjust decls to match defn changes elsewhere. (struct gl_state_s): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. * sysdep.c (wait_for_termination_1, wait_for_termination) (interruptible_wait_for_termination, mkdir): Don't assume pid_t fits in int; on 64-bit AIX pid_t is 64-bit. (emacs_read, emacs_write): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. (system_process_attributes): Don't assume uid_t, gid_t, and double all fit in int or even EMACS_INT. * term.c (set_tty_color_mode): Check that fixnums are in proper range for system types. * termhooks.h (struct input_event): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. * textprop.c (validate_interval_range, interval_of) (Fadd_text_properties, set_text_properties_1) (Fremove_text_properties, Fremove_list_of_text_properties) (Ftext_property_any, Ftext_property_not_all) (copy_text_properties, text_property_list, extend_property_ranges) (verify_interval_modification): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. (Fnext_single_char_property_change) (Fprevious_single_char_property_change): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. (copy_text_properties): Check for integer overflow in index calculation. * undo.c (last_boundary_position, record_point, record_insert) (record_delete, record_marker_adjustment, record_change) (record_property_change): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. (truncate_undo_list, Fprimitive_undo): Don't assume fixnum fits in int. Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. * w32fns.c (Fx_create_frame, x_create_tip_frame, Fx_show_tip) (Fx_hide_tip, Fx_file_dialog): * w32menu.c (set_frame_menubar): Use ptrdiff_t, not int, for consistency with rest of code. * window.c (window_scroll_preserve_hpos, window_scroll_preserve_vpos) (select_window, Fdelete_other_windows_internal) (window_scroll_pixel_based, window_scroll_line_based) (Frecenter, Fset_window_configuration): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. (Fset_window_hscroll, run_window_configuration_change_hook) (set_window_buffer, temp_output_buffer_show, scroll_command) (Fscroll_other_window): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. (Fwindow_line_height, window_scroll, Fscroll_left, Fscroll_right): Don't assume fixnum fits in int. (Fset_window_scroll_bars): Check that fixnums are in proper range for system types. * xdisp.c (help_echo_pos, pos_visible_p, string_pos_nchars_ahead) (string_pos, c_string_pos, number_of_chars, init_iterator) (in_ellipses_for_invisible_text_p, init_from_display_pos) (compute_stop_pos, next_overlay_change, compute_display_string_pos) (compute_display_string_end, handle_face_prop) (face_before_or_after_it_pos, handle_invisible_prop, handle_display_prop) (handle_display_spec, handle_single_display_spec) (display_prop_intangible_p, string_buffer_position_lim) (string_buffer_position, handle_composition_prop, load_overlay_strings) (get_overlay_strings_1, get_overlay_strings) (iterate_out_of_display_property, forward_to_next_line_start) (back_to_previous_visible_line_start, reseat, reseat_to_string) (get_next_display_element, set_iterator_to_next) (get_visually_first_element, compute_stop_pos_backwards) (handle_stop_backwards, next_element_from_buffer) (move_it_in_display_line_to, move_it_in_display_line) (move_it_to, move_it_vertically_backward, move_it_by_lines) (add_to_log, message_dolog, message_log_check_duplicate) (message2, message2_nolog, message3, message3_nolog (with_echo_area_buffer, display_echo_area_1, resize_mini_window_1) (current_message_1, truncate_echo_area, truncate_message_1) (set_message, set_message_1, store_mode_line_noprop) (hscroll_window_tree, debug_delta, debug_delta_bytes, debug_end_vpos) (text_outside_line_unchanged_p, check_point_in_composition) (reconsider_clip_changes) (redisplay_internal, set_cursor_from_row, try_scrolling) (try_cursor_movement, set_vertical_scroll_bar, redisplay_window) (redisplay_window, find_last_unchanged_at_beg_row) (find_first_unchanged_at_end_row, row_containing_pos, try_window_id) (trailing_whitespace_p, find_row_edges, display_line) (RECORD_MAX_MIN_POS, Fcurrent_bidi_paragraph_direction) (display_mode_element, store_mode_line_string) (pint2str, pint2hrstr, decode_mode_spec) (display_count_lines, display_string, draw_glyphs) (x_produce_glyphs, x_insert_glyphs) (rows_from_pos_range, mouse_face_from_buffer_pos) (fast_find_string_pos, mouse_face_from_string_pos) (note_mode_line_or_margin_highlight, note_mouse_highlight): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. (safe_call, init_from_display_pos, handle_fontified_prop) (handle_single_display_spec, load_overlay_strings) (with_echo_area_buffer, setup_echo_area_for_printing) (display_echo_area, echo_area_display) (x_consider_frame_title, prepare_menu_bars, update_menu_bar) (update_tool_bar, hscroll_window_tree, redisplay_internal) (redisplay_window, dump_glyph_row, display_mode_line, Fformat_mode_line) (decode_mode_spec, on_hot_spot_p): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. (handle_single_display_spec, build_desired_tool_bar_string) (redisplay_tool_bar, scroll_window_tree, Fdump_glyph_matrix) (get_specified_cursor_type): Check that fixnums are in proper range for system types. (struct overlay_entry, resize_mini_window, Fdump_glyph_row) (Flookup_image_map): Don't assume fixnums fit in int. (compare_overlay_entries): Avoid mishandling comparisons due to subtraction overflow. (load_overlay_strings): Use SAFE_NALLOCA, not alloca. (last_escape_glyph_face_id, last_glyphless_glyph_face_id): (handle_tool_bar_click): Use int, not unsigned, since we prefer signed and the signedness doesn't matter here. (get_next_display_element, next_element_from_display_vector): Use int, not EMACS_INT, when int is wide enough. (start_hourglass): Use duration_to_sec_usec to do proper overflow checking on durations. * xfaces.c (Fbitmap_spec_p): Check that fixnums are in proper range for system types. (compare_fonts_by_sort_order): Avoid mishandling comparisons due to subtraction overflow. (Fx_family_fonts, realize_basic_faces): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. (Fx_family_fonts): Don't assume fixnum fits in int. Use SAFE_ALLOCA_LISP, not alloca. (merge_face_heights): Remove unnecessary cast to EMACS_INT. (Finternal_make_lisp_face): Don't allocate more than MAX_FACE_ID. (face_at_buffer_position, face_for_overlay_string) (face_at_string_position): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. (merge_faces): Use int, not EMACS_INT, where int is wide enough. * xfns.c (x_set_menu_bar_lines, x_set_tool_bar_lines, x_icon_verify) (Fx_show_tip): Check that fixnums are in proper range for system types. (Fx_create_frame, x_create_tip_frame, Fx_show_tip) (Fx_hide_tip, Fx_file_dialog, Fx_select_font): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. (Fx_change_window_property): Don't assume fixnums fit in int. * xfont.c (xfont_chars_supported): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. * xmenu.c (Fx_popup_dialog, set_frame_menubar) (create_and_show_popup_menu, create_and_show_dialog, xmenu_show): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. * xml.c (parse_region): * xrdb.c (magic_file_p): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. * xselect.c (TRACE1): Don't assume pid_t promotes to int. (x_get_local_selection, x_reply_selection_request) (x_handle_selection_request, wait_for_property_change): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. (selection_data_to_lisp_data): Use short, not EMACS_INT, where short is wide enough. (x_send_client_event): Don't assume fixnum fits in int. * xterm.c (x_x_to_emacs_modifiers): Don't assume EMACS_INT overflows nicely into int. (x_emacs_to_x_modifiers): Use EMACS_INT, not int, because values may come from Lisp. (handle_one_xevent): NATNUMP can eval its arg twice. (x_connection_closed): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. * xterm.h: Adjust decls to match defn changes elsewhere. (struct scroll_bar): Use struct vectorlike_header rather than rolling our own approximation. (SCROLL_BAR_VEC_SIZE): Remove; not used.
* Fix default values of character properties.Kenichi Handa2011-08-231-2/+0
|
* Use uniprop tables instead of biditype.h and bidimirror.h.Eli Zaretskii2011-08-151-8/+17
| | | | | | | | | | | | | | | | | | | | | | src/bidi.c (bidi_initialize): Use uniprop_table instead of including biditype.h and bidimirror.h. src/biditype.h: File removed. src/bidimirror.h: File removed. src/deps.mk (bidi.o): Remove biditype.h and bidimirror.h. src/makefile.w32-in ($(BLD)/bidi.$(O)): Remove biditype.h and bidimirror.h. src/dispextern.h: Fix a typo in the comment to bidi_type_t. src/chartab.c: Improve commentary for the uniprop_table API. admin/unidata/bidimirror.awk: File removed. admin/unidata/biditype.awk: File removed. admin/unidata/makefile.w32-in (all): Remove src/biditype.h and src/bidimirror.h. (../../src/biditype.h, ../../src/bidimirror.h): Deleted. admin/unidata/Makefile.in (all): Remove src/biditype.h and src/bidimirror.h. (../../src/biditype.h, ../../src/bidimirror.h): Deleted.
* Merge from trunk.Paul Eggert2011-08-021-1/+1
|
* Fix minor problems found by static checking.Paul Eggert2011-07-081-7/+1
| | | | | | | | * chartab.c (char_table_set_range, map_sub_char_table) (uniprop_table_uncompress): Remove unused locals. (uniprop_table): Now static. * composite.c (_work_char): Remove unused static var. * gtkutil.c (qttip_cb): Remove stray no-effect statement.
* chartab.c (sub_char_table_set_range): Fix previous change.Kenichi Handa2011-07-071-1/+1
|
* Add C interface for Unicode character property table.Kenichi Handa2011-07-071-72/+507
|
* * chartab.c (Fchar_table_range): Use CHARACTERP to check range.Paul Eggert2011-06-121-3/+3
| | | | | Otherwise, an out-of-range integer could cause undefined behavior on a 64-bit host.
* lisp.h: Fix a problem with aliasing and vector headers.Paul Eggert2011-04-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Undo the DEFUN->DEFUE change.Paul Eggert2011-04-131-6/+6
|
* * chartab.c (chartab_chars, chartab_bits): Now static.Paul Eggert2011-04-101-2/+2
|