aboutsummaryrefslogtreecommitdiffstats
path: root/src/fns.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Speed up 'equal'-comparison of vectorlike objectsMattias Engdegård2026-02-241-38/+35
| | | | | * src/fns.c (internal_equal_1): Switch on the vectorlike type instead of using a sequence of type predicates.
* Compare circular lists in 'equal' without error (bug#80456)Mattias Engdegård2026-02-241-1/+37
| | | | | | | | | | | | | | | | | | * src/lisp.h (FOR_EACH_TAIL_INTERNAL): Divvy up the code into... (FOR_EACH_TAIL_BASIC, FOR_EACH_TAIL_STEP_CYCLEP): ...these macros, so that they can be used in more flexible ways. * src/fns.c (internal_equal_1): Detect circular lists and call... (internal_equal_cycle): ...this function that keeps comparing but now detecting cycles in the other argument. * lisp/emacs-lisp/testcover.el (testcover-after): Remove unnecessary error handling. * test/src/fns-tests.el (test-cycle-equal): Adapt and extend. * test/lisp/emacs-lisp/testcover-resources/testcases.el (testcover-testcase-cyc1): Remove case that no longer applies. * doc/lispref/objects.texi (Equality Predicates): Update. * etc/NEWS: Announce.
* Add SHA-3 support to secure-hashCollin Funk2026-02-231-14/+44
| | | | | | | | | | | | | | | | | | | | | | | * admin/merge-gnulib (GNULIB_MODULES): Add crypto/sha3-buffer. * lib/sha3.c: New file, imported by running admin/merge-gnulib. * lib/sha3.h: Likewise. * m4/sha3.m4: Likewise. * lib/gnulib.mk.in: Updated by admin/merge-gnulib. * m4/gnulib-comp.m4: Likewise. * src/fns.c: Include sha3.h (Fsecure_hash_algorithms): Add Qsha3_224, Qsha3_256, Qsha3_384, and Qsha3_512. (secure_hash): Likewise. (Fsecure_hash): List the SHA-3 algorithms in the docstring. (syms_of_fns): Define Qsha3_224, Qsha3_256, Qsha3_384, and Qsha3_512. * test/lisp/net/gnutls-tests.el (gnutls-tests-internal-macs-upcased): Filter out the new SHA-3 algorithms since they are currently not implemented in gnutls. * test/src/fns-tests.el (test-secure-hash): Add test cases for the new algorithms. * doc/lispref/text.texi (Checksum/Hash): List the SHA-3 algorithms. Mention that they are considered secure. * etc/NEWS: Mention the new feature.
* Remove vla.hPaul Eggert2026-02-131-1/+0
| | | | | | | | Uses of <vla.h>’s macro VLA_ELEMS were removed some time ago. * admin/merge-gnulib (GNULIB_MODULES): Remove vla. * lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate. * lib/vla.h: Remove. * src/fns.c, src/lread.c: Do not include <vla.h>.
* system-sleep sleep blocker and sleep/wake event package (bug#80348)Stéphane Marks2026-02-111-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This package provides platform-neutral interfaces to block your system from entering idle sleep and a hook to process pre-sleep and post-wake events. Implementations are for D-Bus on GNU/Linux, macOS/GNUstep, and MS-Windows. * lisp/system-sleep.el: New package. * src/fns.c: Qpre_sleep, Qpost_wake: New DEFSYM. * src/nsfns.m (Fns_block_system_sleep, Fns_unblock_system_sleep) (syms_of_nsfns): New functions. * src/nsterm.m (applicationDidFinishLaunching): Subscribe to pre-sleep and post-wake notifications. (systemWillSleep, systemDidWake): New function. * src/w32fns.c (Fw32_block_system_sleep) (Fw32_unblock_system_sleep, Fw32_system_sleep_block_count) (sleep_notification_callback) (w32_register_for_sleep_notifications): New function. (syms_of_w32fns): Sw32_unblock_system_sleep Sw32_block_system_sleep Sw32_system_sleep_block_count: New defsubr. * src/w32term.h (Fw32_block_system_sleep): New extern. * src/w32term.c (w32_initialize): Call w32_register_for_sleep_notifications. * doc/lispref/os.texi: Document the system-sleep package. * doc/lispref/commands.texi: Update sleep-event special documentation. * etc/NEWS: Announce the new package.
* Fix crash where dead frame remains on list of live frames (Bug#80120)Martin Rudalics2026-01-111-0/+25
| | | | | | | * src/fns.c (delq_no_quit): New function. * src/lisp.h: Extern delq_no_quit. * src/frame.c (delete_frame): Call delq_no_quit to remove frame from Vframe_list uninterruptedly (Bug#80120).
* ; Add 2026 to copyright years.Sean Whitton2026-01-011-1/+1
|
* Cache VC incoming revisionsSean Whitton2025-11-301-2/+2
| | | | | | | | | * lisp/vc/vc-hooks.el (vc-file-setprop): Use cl-pushnew. (vc--repo-setprop, vc--repo-getprop, vc--repo-clearprops): New functions. * lisp/vc/vc.el (vc--incoming-revision): Cache incoming revisions. * src/fns.c (Fput): State that VALUE is returned.
* A few more functions are not purePaul Eggert2025-11-201-2/+1
| | | | | | | | | | | | | | | | | Assuming ATTRIBUTE_PURE means that the function must return, a few more functions that should not be declared with ATTRIBUTE_PURE. The GCC manual (and even the C23 standard, with [[reproducible]]) is not clear about this, and it’s better to be safe. * src/bignum.h (mpz_get_d_rounded): * src/lisp.h (bignum_to_double): No longer pure, as it does not return if memory is exhausted. * src/fns.c (Fproper_list_p): No longer pure, as it does not return if the user quits. * src/gnutls.c (Fgnutls_errorp): No longer pure, as it does not return if it runs into an eassert failure in XSYMBOL_WITH_POS via EQ. * src/lisp.h (bignum_to_intmax, bignum_to_uintmax, bignum_bufsize): No longer pure, as it does not return if it runs into an eassert failure in XBIGNUM via xbignum_val.
* Fix more mis-declarations of non-const functionsPaul Eggert2025-11-201-1/+1
| | | | | | | | | Problem reported by Helmut Eller in: https://lists.gnu.org/r/emacs-devel/2025-11/msg00809.html * src/data.c (Fsymbol_with_pos_p, Fnatnump): * src/fns.c (Fproper_list_p): * src/gnutls.c (Fgnutls_errorp): Now pure, not const.
* Disallow string data resizing (bug#79784)Mattias Engdegård2025-08-241-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | Only allow string mutation that is certain not to require string data to be resized and reallocated: writing bytes into a unibyte string, and changing ASCII to ASCII in a multibyte string. This ensures that mutation will never transform a unibyte string to multibyte, that the size of a string in bytes never changes, and that the byte offsets of characters remain the same. Most importantly, it removes a long-standing obstacle to reform of string representation and allow for future performance improvements. * src/data.c (Faset): Disallow resizing string mutation. * src/fns.c (clear_string_char_byte_cache): * src/alloc.c (resize_string_data): Remove. * test/src/data-tests.el (data-aset-string): New test. * test/lisp/subr-tests.el (subr--subst-char-in-string): Skip error cases. * test/src/alloc-tests.el (aset-nbytes-change): Remove test that is no longer relevant. * doc/lispref/strings.texi (Modifying Strings): * doc/lispref/sequences.texi (Array Functions): * doc/lispref/text.texi (Substitution): Update manual. * etc/NEWS: Announce.
* * src/fns.c (Flength): Fix char table length off-by-one bug.Mattias Engdegård2025-07-111-1/+1
|
* * src/fns.c (mapcar1): Less lax type checkingMattias Engdegård2025-06-151-2/+3
| | | | | Previously, mapcar etc would crash or return nonsense when passed a record. Found by Pip Cet.
* ; * src/fns.c (fixnum_float_cmp): Don't use non-ASCII characters.Eli Zaretskii2025-05-311-1/+1
|
* Pacify GCC 15 -Wunterminated-string-initializationPaul Eggert2025-04-191-1/+1
| | | | | | * src/fns.c (hexbuf_digest): * src/json.c (json_out_string): Add ATTRIBUTE_NONSTRING to character arrays that are not strings.
* Avoid name clashes with static GnuTLSPaul Eggert2025-04-191-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Work around a bug in GnuTLS 3.7.11 and earlier: when built statically, its mistakenly exports symbols hash_lookup and hash_string, which collide with Emacs symbols of the same name, preventing temacs from linking statically. Problem reported by Greg A. Woods (Bug#77476). Because GnuTLS never uses hash_lookup or hash_string this issue ordinarily doesn’t seem to prevent temacs from linking to GnuTLS on GNU/Linux, as it’s linked dynamically and the dynamic linker never needs to resolve references to either symbol. However, I suppose a clash or bug could occur even with dynamic linking if Emacs later loads a module that uses either symbol. Although GnuTLS should be fixed, Emacs should link statically to current and older GnuTLS versions in the meantime, and it should avoid potential problems with dynamic linking. Renaming the two clashing names is an easy way to do this. For consistency with the new name for hash_lookup, also rename hash_lookup_with_hash and hash_lookup_get_hash. * src/fns.c (hash_find_with_hash): Rename from hash_lookup_with_hash. (hash_find): Rename from hash_lookup. (hash_find_get_hash): Rename from hash_lookup_get_hash. (hash_char_array): Rename from hash_string. All uses changed.
* Pacify "statement not reached" in value_cmpPaul Eggert2025-04-191-3/+1
| | | | | Problem found by Oracle Developer Studio 12.6. * src/fns.c (value_cmp): Omit unnecessary goto.
* Fix capitalization ELisp -> ElispSean Whitton2025-03-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * configure.ac (libgccjit_not_found_err) (libgccjit_dev_not_found_err): * doc/emacs/buffers.texi (List Buffers): * doc/lispref/elisp.texi (Tree-sitter C API): * doc/lispref/functions.texi (What Is a Function): * doc/lispref/parsing.texi (Parsing Program Source) (Tree-sitter C API): * doc/misc/gnus.texi (The Gnus Registry): * etc/DEBUG: * etc/NEWS: * etc/NEWS.25: * etc/NEWS.26: * etc/NEWS.28: * etc/NEWS.30: * etc/TODO: * lib-src/emacsclient.c (print_help_and_exit): * lisp/auth-source.el (auth-source-search): * lisp/cedet/semantic/bovine/el.el (emacs-lisp-mode): * lisp/cedet/semantic/wisent/comp.el (wisent-automaton-lisp-form): * lisp/cedet/srecode/el.el (srecode-semantic-apply-tag-to-dict): * lisp/editorconfig.el (editorconfig-get-local-variables-functions): * lisp/emacs-lisp/bindat.el (bindat-type): * lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand): * lisp/emacs-lisp/cconv.el (cconv-make-interpreted-closure): * lisp/emacs-lisp/cl-macs.el (cl--labels-convert): * lisp/emacs-lisp/lisp-mode.el (lisp-fdefs) (lisp-fill-paragraphs-as-doc-string): * lisp/emacs-lisp/macroexp.el (macroexp--fgrep): * lisp/emacs-lisp/oclosure.el (cconv--interactive-helper): * lisp/emacs-lisp/re-builder.el: * lisp/erc/erc-button.el (erc-emacswiki-lisp-url): * lisp/help-fns.el (help-fns--describe-function-or-command-prompt): * lisp/menu-bar.el (menu-bar-search-documentation-menu): * lisp/net/tramp-message.el (tramp-debug-font-lock-keywords): * lisp/org/org-capture.el (org-capture): * lisp/org/org.el (org-category, org-todo): * lisp/org/ox.el (org-export-async-start): * lisp/progmodes/elisp-mode.el (emacs-lisp-mode): * lisp/progmodes/peg.el (peg-translate-exp): * lisp/progmodes/ruby-ts-mode.el: * lisp/woman.el (woman-mode, woman-parse-numeric-arg): * src/chartab.c (map_char_table_for_charset): * src/fns.c (extract_data_from_object): * src/frame.c (do_switch_frame): * src/keyboard.c (make_lispy_event): * test/lisp/emacs-lisp/cl-macs-tests.el (cl-&key-arguments): * test/lisp/emacs-lisp/shortdoc-tests.el (shortdoc-help-fns-examples-function-test): * test/manual/etags/c-src/emacs/src/keyboard.c (make_lispy_event): Fix capitalization ELisp -> Elisp.
* Re-port to 32-bit systems without alignment primitivesPo Lu2025-03-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * configure.ac (ALIGNOF_INT, ALIGNOF_LONG, ALIGNOF_LONG_LONG): New variables. (emacs_cv_alignas_unavailable): Define if alignas and structure alignment primitives are unavailable. In such an environment, the MSB tagging scheme must be enabled, as must the GNU malloc. * msdos/sed2v2.inp: Adjust correspondingly. * src/alloc.c (union emacs_align_type): Remove types which contain flexible array members. The address of a field subsequent to an aggregate with flexible array members cannot validly be taken. (mark_memory) [!USE_LSB_TAG && !WIDE_EMACS_INT]: Strip type bits before scanning memory. * src/emacs.c (main): * src/eval.c (Fautoload_do_load): * src/fns.c (Frequire): Rename a number of illogically named fields. * src/lisp.h (ALIGNOF_EMACS_INT): Define to the natural alignment of EMACS_INT. (IDEAL_GCALIGNMENT): New macro. (USE_LSB_TAG): Disable if no alignment specifiers are available, WIDE_EMACS_INT is undefined, and the natural alignment of EMACS_INT falls short of LSB tagging's requirements. (gflags): Rename illogically named fields and don't define them as bitfields, which runs afoul of certain compiler issues. (will_dump_p, will_bootstrap_p, will_dump_with_pdumper_p) (dumped_with_pdumper_p): Adjust accordingly. * src/pdumper.c (VM_SUPPORTED): Define to 0 when !USE_LSB_TAG. It is better to read dump files into the heap by hand than to be supplied with an address that is not representable. (_dump_object_start_pseudovector): Rename to dump_object_start_pseudovector, to avoid encroaching on reserved names. (START_DUMP_PVEC): Adjust correspondingly. (dump_mmap_contiguous_vm): Preserve errno around failure cleanup. (dump_bitset_bit_set_p): Work around certain compiler issues. (pdumper_load) [!USE_LSB_TAG]: Reject dump file allocations that are not representable as Lisp_Objects. Tested on i386-unknown-solaris2.10, sparc-sun-solaris2.10.
* Merge from origin/emacs-30Eli Zaretskii2025-03-011-0/+5
|\ | | | | | | | | 6f5c322f597 Recommend secure-hash in md5 docstring 1352b184f3f Improve docstring of add-hook and remove-hook
| * Recommend secure-hash in md5 docstringStefan Kangas2025-02-281-0/+5
| | | | | | | | | | * src/fns.c (Fmd5): Repeat explanation from manual about md5 being "semi-obsolete", and recommend using secure-hash instead.
* | Lift widget functions from C to LispStefan Kangas2025-02-281-61/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the mid-1990s, these functions were moved from Lisp to C to "improve performance". However, Moore's Law, and perhaps other improvements too, has made this rationale irrelevant. On this machine, with --native-compilation=no, I observed only a slight ~4% performance difference. For example, displaying a buffer full of widgets (e.g., 'M-x customize RET browse-url RET') takes 4ms here, meaning the performance gap is under 0.1ms. Even on less powerful machines, this difference would remain imperceptible. Given this, let's lift these functions back to to Lisp, which offers the usual benefits. We already have solid test coverage, but let's add a more focused test for 'widget-get' and 'widget-put' to be thorough. * lisp/wid-edit.el (widget-put, widget-get, widget-apply): Move to Lisp from... * src/fns.c (Fwidget_put, Fwidget_get, Fwidget_apply): ...here. (syms_of_fns): Remove defsubrs for the above functions. * test/lisp/wid-edit-tests.el (widget-test-editable-field-widget-get/put): New test.
* | * src/fns.c (Fmapconcat): Faster fast-path conditionMattias Engdegård2025-02-201-1/+1
| |
* | Merge from savannah/emacs-30Po Lu2025-02-151-1/+2
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | 58e4bfe3408 Add two missing NULL checks of malloc'd values on Android 81ca9c75f11 ; * etc/PROBLEMS: Document how to grant storage permissio... d82d4689794 ; * etc/TODO: Rethink finder-known-keywords. b9b9c33dcbe Fix (Non)GNU ELPA description in manual 87a61eba1b8 Move 'package-archives' documentation to emacs manual 316e47c5af4 ; * src/fns.c (Fmapconcat): Doc fix (bug#76242). 3cfbeb3fca1 ; Fix >72 character long lines in docstring c68886ddb76 ; Change "virus" to "malicious" in lispref 6701866be4d Document (Non-)GNU ELPA in emacs manual 02851768b72 ; * .mailmap: Add entry for Thuna. (Bug#76221) 2d7a8cbf4c8 Fix author name 19314257485 Use c-ts-common's comment setup in go-ts-mode (bug#75978) 316893ca387 Add java-language-server to eglot-server-programs
| * ; * src/fns.c (Fmapconcat): Doc fix (bug#76242).Eli Zaretskii2025-02-131-1/+2
| |
| * Update copyright year to 2025Stefan Kangas2025-01-021-1/+1
| | | | | | | | Run "TZ=UTC0 admin/update-copyright".
* | Merge branch 'scratch/no-purespace' into 'master'Stefan Kangas2025-02-011-30/+7
|\ \
| * | ; * src/fns.c (maybe_resize_hash_table): Remove debugging code.Pip Cet2024-12-161-5/+0
| | |
| * | Pure storage removal: Remove purecopy hash table flagPip Cet2024-12-121-21/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/emacs-liqsp/comp.el (comp--jump-table-optimizable): Adjust comment. * src/category.c (hash_get_category_set): * src/emacs-module.c (syms_of_module): * src/fns.c (make_hash_table): Remove 'purecopy' flag and update docstring. (Fmake_hash_table): Ignore ':purecopy' argument. * src/frame.c (make_frame): * src/image.c (xpm_make_color_table_h): * src/lisp.h (struct Lisp_Hash_Table): Drop 'purecopy' flag. * src/pdumper.c (dump_hash_table): Don't dump 'purecopy' flag. * src/print.c (print_object): Don't print 'purecopy' flag * src/json.c (json_parse_object): * src/lread.c (readevalloop, read_internal_start): * src/pgtkterm.c (syms_of_pgtkterm): * src/profiler.c (export_log): * src/xfaces.c (syms_of_xfaces): * src/xterm.c (syms_of_xterm): Adjust calls to 'make_hash_table'.
| * | Pure storage removal: Replace calls to removed functionsPip Cet2024-12-121-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/alloc.c (string_bytes, pin_string, valid_lisp_object_p) (process_mark_stack, survives_gc_p, syms_of_alloc): * src/androidterm.c (android_term_init): Replace call to 'build_pure_c_string'. * src/buffer.c (init_buffer_once, syms_of_buffer): * src/bytecode.c (exec_byte_code): * src/callint.c (syms_of_callint): * src/callproc.c (syms_of_callproc): * src/category.c (Fdefine_category): * src/coding.c (syms_of_coding): * src/comp.c (Fcomp__compile_ctxt_to_file0) (maybe_defer_native_compilation, syms_of_comp): * src/data.c (Fsetcar, Fsetcdr, Fdefalias, Faset, syms_of_data): * src/dbusbind.c (syms_of_dbusbind): * src/doc.c (Fsnarf_documentation): * src/emacs-module.c (syms_of_module): * src/eval.c (Finternal__define_uninitialized_variable) (Fdefconst_1, define_error, syms_of_eval): * src/fileio.c (syms_of_fileio): * src/fns.c (Ffillarray, Fclear_string, check_mutable_hash_table): * src/fontset.c (syms_of_fontset): * src/frame.c (make_initial_frame): * src/haikufns.c (syms_of_haikufns): * src/intervals.c (create_root_interval): * src/keyboard.c (syms_of_keyboard): * src/keymap.c (Fmake_sparse_keymap, Fset_keymap_parent) (store_in_keymap, syms_of_keymap): * src/lisp.h: * src/lread.c (Fload, read0, intern_c_string_1, define_symbol) (Fintern, defsubr, syms_of_lread): * src/pdumper.c (Fdump_emacs_portable): * src/pgtkfns.c (syms_of_pgtkfns): * src/pgtkterm.c (syms_of_pgtkterm): * src/process.c (syms_of_process): * src/search.c (syms_of_search): * src/sqlite.c (syms_of_sqlite): * src/syntax.c (syms_of_syntax): * src/treesit.c (syms_of_treesit): * src/w32fns.c (syms_of_w32fns): * src/xdisp.c (syms_of_xdisp): * src/xfaces.c (syms_of_xfaces): * src/xfns.c (syms_of_xfns): * src/xftfont.c (syms_of_xftfont): * src/xterm.c (syms_of_xterm): Remove calls to 'PURE_P', 'CHECK_IMPURE', 'Fpurecopy', and replace calls to 'build_pure_c_string', 'pure_list', 'pure_listn', etc., by impure equivalents.
| * | Pure storage removal: Main partPip Cet2024-12-121-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/alloc.c (pure, PUREBEG, purebeg, pure_size) (pure_bytes_used_before_overflow, pure_bytes_used_lisp) (pure_bytes_used_non_lisp): Remove definitions. (init_strings): Make empty strings impure. (cons_listn): Drop 'cons' argument. (pure_listn): Remove function. (init_vectors): Allocate zero vector manually to avoid freelist issues. (pure_alloc, check_pure_size, find_string_data_in_pure) (make_pure_string, make_pure_c_string, pure_cons, make_pure_float) (make_pure_bignum, make_pure_vector, purecopy_hash_table): Remove functions. (purecopy): Reduce to hash consing our argument. (init_alloc_once_for_pdumper): Adjust to lack of pure space. (pure-bytes-used): Adjust docstring to mark as obsolete. (purify-flag): Keep for hash consing, but adjust docstring. * src/bytecode.c: * src/comp.c: Don't include "puresize.h". * src/conf_post.h (SYSTEM_PURESIZE_EXTRA): Remove definition. * src/data.c (pure_write_error): Remove function. * src/deps.mk: Remove puresize.h dependency throughout. * src/emacs.c: * src/fns.c: * src/intervals.c: * src/keymap.c: Don't include "puresize.h". * src/lisp.h (struct Lisp_Hash_Table): Adjust comment. (pure_listn, pure_list, build_pure_c_string): Remove. * src/w32heap.c (FREEABLE_P): Don't do use 'dumped_data'. (malloc_before_dump, realloc_before_dump, free_before_dump): Remove functions. * src/w32heap.h: Adjust prototype. * lisp/loadup.el: * lisp/startup.el: Remove purespace code.
* | | Remove redundant case_Lisp_Int macroStefan Kangas2025-01-201-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The case_Lisp_Int macro was originally introduced with different definitions depending on USE_2_TAGS_FOR_INTS. However, since commit 2b5701247845, we have assumed that USE_2_TAGS_FOR_INTS is always defined, and the macro has only a single definition. As a result, the macro is now unnecessary, and replacing it with standard C case labels improves readability and understanding. * src/lisp.h (case_Lisp_Int): Delete macro. * src/alloc.c (process_mark_stack, survives_gc_p): * src/data.c (Fcl_type_of): * src/fns.c (value_cmp, sxhash_obj): * src/pdumper.c (dump_object): * src/print.c (print_object): * src/xfaces.c (face_attr_equal_p): Remove uses of above macro.
* | | Replace call[1-8] with callnStefan Kangas2025-01-191-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since the introduction of the 'calln' macro, the 'call1', 'call2', ..., 'call8' macros are just aliases for the former. This is slightly misleading and potentially unhelpful. The number of arguments N can also easily go out-of-synch with the used alias callN. There is no reason not to replace these aliases with using 'calln' directly. To reduce the risk for mistakes, the tool Coccinelle was used to make these changes. See <https://coccinelle.gitlabpages.inria.fr/website/>. * src/alloc.c, src/androidvfs.c, src/androidfns.c, src/buffer.c: * src/callint.c, src/callproc.c, src/casefiddle.c, src/charset.c: * src/chartab.c, src/cmds.c, src/coding.c, src/composite.c: * src/data.c, src/dbusbind.c, src/dired.c, src/doc.c: * src/emacs.c, src/eval.c, src/fileio.c, src/filelock.c: * src/fns.c, src/frame.c, src/gtkutil.c, src/haikufns.c: * src/haikumenu.c, src/image.c, src/insdel.c, src/intervals.c: * src/keyboard.c, src/keymap.c, src/lisp.h, src/lread.c: * src/minibuf.c, src/nsfns.m, src/nsselect.m, src/pgtkfns.c: * src/pgtkselect.c, src/print.c, src/process.c, src/sort.c: * src/syntax.c, src/textconv.c, src/textprop.c, src/undo.c: * src/w32fns.c, src/window.c, src/xfaces.c, src/xfns.c: * src/xmenu.c, src/xselect.c, src/xterm.c: Replace all uses of 'call1', 'call2', ..., 'call8' with 'calln'.
* | | Fix clear-string crash with text propertiesStefan Kangas2025-01-151-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | * src/fns.c (Fclear_string): Fix crash by clearing all text properties. (Bug#75581) * doc/lispref/strings.texi (Modifying Strings): Document the above behavior change. Fix proposed by Andreas Schwab <schwab@linux-m68k.org>.
* | | Improve 'gethash' docstringStefan Kangas2025-01-091-1/+4
| | | | | | | | | | | | | | | * src/fns.c (Fgethash): Improve docstring. Avoid exposing the C identifier 'dflt' to Lisp by providing a "usage:" string.
* | | Update copyright year to 2025Paul Eggert2025-01-011-1/+1
| | | | | | | | | | | | Run "TZ=UTC0 admin/update-copyright".
* | | Fix tty root frame collection in redisplay_internalGerd Möllmann2024-12-201-0/+9
|/ / | | | | | | | | | | | | * src/fns.c (memq_no_quit): New function. * src/lisp.h: Declare it. * src/xdisp.c (redisplay_internal): Use memq_no_quit instead of assq_no_quit.
* | Fix 'internal_equal' so that it uses at most one hash tableEthan Kong2024-11-091-8/+15
| | | | | | | | | | | | | | | | | | | | The old implementation passed the hash table by value in recursive tests, which would cause each recursive level to initialize its own hash table, causing excess memory usage. * src/fns.c (internal_equal): Delegate to 'internal_equal_1'. (internal_equal_1): New function; body from old 'internal_equal'. Pass the hash table argument by reference instead of by value. (Bug#73883)
* | Merge from origin/emacs-30Eli Zaretskii2024-09-281-1/+6
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | e8830015b07 Require ert-x for use by 'ert-font-lock-deftest-file' a1841b4d8e7 ; * admin/authors.el (authors-aliases): Don't ignore "one... 69d8f9d1b70 Fix php-ts-mode font-lock for latest PHP grammar (bug#73516) 68f53e43488 eieio.texi: Fix bug#73505 53c887fdf6d ; cperl-mode.el: Fix an invalid face specification f5cd5585f46 ; Recommend GNU Find for 'find-dired' 65e589698e6 ; * lisp/filesets.el (filesets-homepage): Fix URL. 1f243a97806 Delete duplicated line in Viper refcard d63bff4d88f Fix Tramp shortdoc integration 759b18a33c0 * lisp/imenu.el (imenu-flatten): More limitations in docs... 794bb2a2e31 remember-data-file: Don't unconditionally call set-visite... 7766ba84199 Align columns in which-key with wide characters properly bd25a98b4e7 bibtex-mode: fix patch bibtex validation for non-file buf... 4729065ee78 Document 'buttonize-region' in manual f189457e5aa ; * lisp/yank-media.el (yank-media-handler): Fix docstrin... 2b53e11a087 Use black-on-white by default for doc-view-svg-face. 32d0c8f6af5 etags-regen-file-extensions: Enable for more extensions 8f265b49e3d ; Fix last change c8ed48b9901 ; Improve documentation of 'append' c1f2501f55d Update and improve UI of sql-read-product (bug#73412) 4f5fc519f09 Insert correct commit data into VC package descriptions 98177d4b3d1 Document reporting security issues in user manual b986e2018a4 * BUGS: Minor copy edit.
| * ; Fix last changeEli Zaretskii2024-09-231-1/+1
| | | | | | | | | | | | * doc/lispref/lists.texi (Building Lists): * src/fns.c (Fappend): Fix last change (bug#73427). Suggested by Mattias Engdegård <mattias.engdegard@gmail.com>.
| * ; Improve documentation of 'append'Eli Zaretskii2024-09-231-1/+6
| | | | | | | | | | * doc/lispref/lists.texi (Building Lists): * src/fns.c (Fappend): Improve documentation of 'append'. (Bug#73427)
* | yes-or-no-p now uses blankp rather than SYNTAXPaul Eggert2024-09-181-3/+1
| | | | | | | | | | | | | | * src/fns.c: Do not include syntax.h; no longer needed. (Fyes_or_no_p): Use blankp rather than SYNTAX to check whether the prompt ends in nonspace. That way, the test doesn’t depend on the current buffer.
* | Fix yes-or-no-p with multibyte spacesPaul Eggert2024-09-171-8/+10
| | | | | | | | | | | | | | | | | | | | Problem reported by Thomas Klausner (Bug#73307). Emacs shouldn’t use ctype.h, as it doesn’t work for multibyte chars and it doesn’t work with Emacs’s locale model anyway. * src/fns.c: Include syntax.h, not ctype.h. (Fyes_or_no_p): Check the character category with SYNTAX, not with isspace, which assumes the current locale and works only with single-byte characters.
* | Prefer static_assert to verifyStefan Kangas2024-08-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Although static_assert is C11-specific, and Emacs remains on C99, it has been backported to older compilers by Gnulib. Gnulib has already changed to prefer static_assert, and we can do the same. * lib-src/asset-directory-tool.c (main_2): * src/alloc.c (BLOCK_ALIGN, aligned_alloc, lisp_align_malloc) (vectorlike_nbytes, allocate_pseudovector): * src/android.c (android_globalize_reference, android_set_dashes): * src/android.h: * src/androidfont.c (androidfont_draw, androidfont_text_extents): * src/androidvfs.c: * src/bidi.c (BIDI_CACHE_MAX_ELTS_PER_SLOT, bidi_find_bracket_pairs): * src/buffer.c (init_buffer_once): * src/casefiddle.c (do_casify_multibyte_string): * src/dispnew.c (scrolling_window, scrolling): * src/editfns.c (styled_format): * src/emacs-module.c (module_extract_big_integer): * src/fileio.c (Fdo_auto_save): * src/fns.c (next_almost_prime, hash_string): * src/fringe.c (init_fringe): * src/keyboard.h (kbd_buffer_store_event_hold): * src/keymap.c: * src/lisp.h (memclear, reduce_emacs_uint_to_hash_hash, modiff_incr): * src/lread.c (skip_lazy_string): * src/pdumper.c (dump_bignum, Fdump_emacs_portable) (dump_do_dump_relocation, pdumper_load): * src/process.c (make_process, Fmake_process, connect_network_socket): * src/regex-emacs.c: * src/sort.c (tim_sort): * src/sysdep.c (init_random, SSIZE_MAX): * src/thread.c: * src/timefns.c (trillion_factor): * src/unexelf.c: * src/xterm.c (x_send_scroll_bar_event): Prefer static_assert to Gnulib verify. Remove import of verify.h, except when used for other reasons.
* | Simplify and speed up make-hash-table argument parsingMattias Engdegård2024-08-211-70/+42
| | | | | | | | | | | | * src/fns.c (get_key_arg): Remove. (Fmake_hash_table): Traverse argument list once only. Don't allocate a helper array. Use faster comparisons.
* | Merge from savannah/emacs-30Po Lu2024-08-201-1/+3
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | 3419e7ea522 Correct Android failure to open an old CJK font 45ae4de0e7c * lisp/help-fns.el (help-definition-prefixes): Don't dele... fc7581ae2ee ; Fix documentation of secure-hash functions 21be5cadaf1 ; * lisp/subr.el (sha1): Fix typo in docstring. 8715619d485 ; * etc/NEWS: Fix wording of last change. 023d387a7bd Update to Org 9.7.10 b54e8b3741b ; * etc/NEWS: Announce 'shr-fill-text'. acfd91bc0c7 ; * lisp/emacs-lisp/compat.el: Fix header style. 55337dc36a2 * test/infra/gitlab-ci.yml (.tree-sitter-template): Adapt... d8e9eb73c2b Bump use-package version for Emacs 30.1 4d9d3fec1b9 * Makefile.in (CHANGELOG_HISTORY_INDEX_MAX): Bump. 502285e84aa ; * admin/make-tarball.txt: Some clarifications.
| * ; Fix documentation of secure-hash functionsEli Zaretskii2024-08-191-1/+3
| | | | | | | | | | | | | | | | * src/fns.c (Fsecure_hash): * doc/lispref/text.texi (Checksum/Hash): * lisp/subr.el (sha1): Fix documentation wrt to the number of bytes 'secure-hash' and its variants return when BINARY is non-nil. Reported by Pip Cet <pipcet@protonmail.com>.
* | Change list-length intptr_t to ptrdiff_tPaul Eggert2024-07-201-3/+3
| | | | | | | | | | | | | | | | | | * src/fns.c (list_length, Fsafe_length, Fproper_list_p): Use ptrdiff_t not intptr_t for accumulator, since result is ptrdiff_t. This fixes a minor glitch in 2019-01-11T05:35:31!eggert@cs.ucla.edu where I removed unnecessary overflow checks but forgot to change types. This change should alter generated code only on oddball platforms where ptrdiff_t is narrower than intptr_t, e.g., CheriBSD.
* | SAFE_ALLOCA fixesPaul Eggert2024-07-201-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/comp.c (declare_imported_func, emit_simple_limple_call) (declare_lex_function, compile_function): * src/emacs-module.c (funcall_module): * src/fns.c (Fstring_distance): * src/font.c (font_sort_entities): * src/haikumenu.c (digest_menu_items, haiku_menu_show): * src/pgtkselect.c (Fpgtk_register_dnd_targets): * src/xfns.c (Fx_begin_drag): * src/xmenu.c (x_menu_show): * src/xterm.c (x_dnd_compute_toplevels, handle_one_xevent) (x_term_init): Prefer SAFE_NALLOCA to doing size multiplication by hand, to catch unlikely integer overflows. * src/comp.c (emit_simple_limple_call): Fix bug where SAFE_FREE was called too early, leading to unlikely use of freed storage. * src/xterm.c (handle_one_xevent): Remove side effects from SAFE_ALLOCA args, as the args are evaluated twice.
* | Avoid accessing uninitialized bool_vector wordsPaul Eggert2024-07-201-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Although loading uninitialized works from memory and then ignoring the result works fine on conventional architectures, it technically has undefined behavior in C, so redo bool_vector allocation so that the code never does that. This can improve performance when allocating large vectors of nil, since calloc can clear the memory lazily. * src/alloc.c (make_clear_bool_vector): New function, a generalization of make_uninit_bool_vector. (make_uninit_bool_vector): Use it. (Fmake_bool_vector): If !INIT, rely on make_clear_bool_vector. * src/alloc.c (Fbool_vector): * src/fns.c (Freverse): Don’t access uninitialized bool_vector words.