1. 08 Jul, 2020 1 commit
  2. 28 Jun, 2020 1 commit
    • Eli Zaretskii's avatar
      MS-Windows fixes as followup to import of Gnulib 'getrandom' · 162f375b
      Eli Zaretskii authored
      * nt/mingw-cfg.site (gl_cv_lib_assume_bcrypt): Set to "no" to
      disable linking against bcrypt.dll.  (Bug#42095)
      * src/gnutls.c (gnutls_rnd) [WINDOWSNT]: Don't define a function
      pointer, and don't load it from GnuTLS DLL.
      (w32_gnutls_rnd) [WINDOWSNT]: Delete unused function.
      * src/fns.c (gnutls_rnd) [WINDOWSNT]: Don't redirect to
  3. 27 Jun, 2020 1 commit
    • Paul Eggert's avatar
      Use getrandom syscall for nonces · 5ce5cf64
      Paul Eggert authored
      * admin/merge-gnulib (GNULIB_MODULES): Add getrandom.
      * doc/lispref/text.texi (Format of GnuTLS Cryptography Inputs):
      Don’t say that iv-auto uses GNUTLS_RND_NONCE.  Also, don’t say
      that it returns the IV’s actual value, as it never has done that.
      * src/fns.c, src/sysdep.c: Include sys/random.h, for getrandom.
      * src/fns.c (Fsecure_hash_algorithms): Use getrandom so that this
      function does not depend on HAVE_GNUTLS3.
      * src/sysdep.c: Do not include <gnutls/crypto.h>.
      (random_seed) [HAVE_LRAND48]: Can be long int now.
      (init_random) [!WINDOWSNT]: Use getrandom syscall instead
      of opening /dev/urandom, as this works even on GNU/Linux
      hosts that lack /dev/urandom.  Don’t bother with gnutls_rnd
      as it’s not needed now that we have getrandom.
  4. 19 May, 2020 1 commit
    • Paul Eggert's avatar
      Reject attempts to clear pure strings · c5eafccc
      Paul Eggert authored
      * src/fns.c (Ffillarray, Fclear_string):
      Add CHECK_IMPURE here, to be consistent with Faset etc.
      (Ffillarray): Prefer memset when the fill is a single byte.
  5. 12 May, 2020 1 commit
    • Paul Eggert's avatar
      Pacify GCC 10.1.0 · 4645430b
      Paul Eggert authored
      Pacify GCC 10.1.0 so that it does not issue false alarms
      when Emacs is configured with --enable-gcc-warnings.
      * src/dispnew.c (clear_glyph_row):
      * src/fns.c (hash_clear):
      * src/keyboard.c (append_tab_bar_item):
      * src/lisp.h (vcopy):
      * src/xfaces.c (get_lface_attributes_no_remap)
      (Finternal_copy_lisp_face, realize_default_face):
      * src/xmenu.c (set_frame_menubar):
      Work around -Warray-bounds false alarm in GCC 10.1.0.
      * src/intervals.c (copy_properties):
      Avoid -Wnull-dereference false alarm in GCC 10.1.0.
      * src/lisp.h (xvector_contents_addr, xvector_contents):
      New functions, useful for working around GCC bug 95072.
  6. 29 Apr, 2020 1 commit
  7. 17 Apr, 2020 3 commits
    • Paul Eggert's avatar
      Port recent character.h changes to --with-wide-int · 2cb7e866
      Paul Eggert authored
      * src/fns.c (mapcar1):
      * src/keymap.c (Fkey_description):
      * src/syntax.c (scan_lists):
      Prefer ptrdiff_t to EMACS_INT where either will do; this fixes
      newly-introduced type errors on --with-wide-int platforms where
      ptrdiff_t is narrower than EMACS_INT.
      * src/keymap.c (Fkey_description): Rework for clarity; remove goto.
      * src/syntax.c (scan_words, Fforward_comment, scan_lists)):
      Fix unlikely integer overflow problems that can occur on
      --with-wide-int platforms, and that were caught by the recent
      character.h changes.
    • Paul Eggert's avatar
      Prefer more inline functions in character.h · 27d10183
      Paul Eggert authored
      * src/buffer.h (fetch_char_advance, fetch_char_advance_no_check)
      (buf_next_char_len, next_char_len, buf_prev_char_len)
      (prev_char_len, inc_both, dec_both): New inline functions,
      replacing the old character.h macros FETCH_CHAR_ADVANCE,
      DEC_POS, INC_BOTH, DEC_BOTH respectively.  All callers changed.
      These new functions all assume buffer primitives and so need
      to be here rather than in character.h.
      * src/casefiddle.c (make_char_unibyte): New static function,
      replacing the old MAKE_CHAR_UNIBYTE macro.  All callers changed.
      (do_casify_unibyte_string): Use SINGLE_BYTE_CHAR_P instead
      of open-coding it.
      * src/ccl.c (GET_TRANSLATION_TABLE): New static function,
      replacing the old macro of the same name.
      * src/character.c (string_char): Omit 2nd arg.  3rd arg can no
      longer be NULL.  All callers changed.
      * src/character.h (SINGLE_BYTE_CHAR_P): Move up.
      (make_char_multibyte): New static function, replacing
      the old macro MAKE_CHAR_MULTIBYTE.  All callers changed.
      (CHAR_STRING_ADVANCE): Remove; all callers changed to use
      (NEXT_CHAR_BOUNDARY): Remove; it was unused.
      (raw_prev_char_len): New inline function, replacing the
      old PREV_CHAR_BOUNDARY macro.  All callers changed.
      (string_char_and_length): New inline function, replacing the
      old STRING_CHAR_AND_LENGTH macro.  All callers changed.
      (STRING_CHAR): Rewrite in terms of string_char_and_length.
      (string_char_advance): New inline function, replacing the old
      STRING_CHAR_ADVANCE macro.  All callers changed.
      (fetch_string_char_advance): New inline function, replacing the
      old FETCH_STRING_CHAR_ADVANCE macro.  All callers changed.
      (fetch_string_char_as_multibyte_advance): New inline function,
      replacing the old FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE macro.
      All callers changed.
      (fetch_string_char_advance_no_check): New inline function,
      replacing the old FETCH_STRING_CHAR_ADVANCE_NO_CHECK macro.  All
      callers changed.
      * src/regex-emacs.c (HEAD_ADDR_VSTRING): Remove; no longer used.
      * src/syntax.c (scan_lists): Use dec_bytepos instead of
      open-coding it.
      * src/xdisp.c (string_char_and_length): Rename from
      string_char_and_length to avoid name conflict with new function in
      character.h.  All callers changed.
    • Paul Eggert's avatar
      Prefer inline functions in character.h · 3e46a231
      Paul Eggert authored
      In character.h, replace macros with inline functions or enums
      when this is easy.  This improves maintainability and
      on my platform (Fedora 31 x86-64, gcc -O2) improved CPU
      performance very slightly (0.3%) on ‘make compile-always’.
      * src/buffer.h (SANE_TAB_WIDTH, CHARACTER_WIDTH):
      Move here from character.h, and make them inline functions.
      Tune CHARACTER_WIDTH so that ASCII_CHAR_WIDTH is no longer needed.
      (sanitize_tab_width, sanitize_char_width):
      Move here from character.h.
      * src/character.h (MAX_CHAR, MAX_UNICODE_CHAR, MAX_1_BYTE_CHAR)
      Now enum constants instead of macros.
      * src/character.h (CHAR_BYTES): Redo to avoid conditional branches.
      Now inline functions instead of macros.
      (ASCII_CHAR_WIDTH): Remove; no longer used.
      * src/conf_post.h (ATTRIBUTE_PURE): New macro.
      * src/lisp.h (char_table_ref): Use it, for better inlining.
      * src/fns.c (base64_decode_1): Add now-necessary casts.
  8. 27 Mar, 2020 1 commit
    • Paul Eggert's avatar
      Treat out-of-range positions consistently · de00a933
      Paul Eggert authored
      If a position argument to get-byte etc. is an out-of-range integer,
      treat it the same regardless of whether it is a fixnum or a bignum.
      * src/buffer.c (fix_position): New function.
      * src/buffer.c (validate_region):
      * src/character.c (Fget_byte):
      * src/coding.c (Ffind_coding_systems_region_internal)
      * src/composite.c (Ffind_composition_internal):
      * src/editfns.c (Fposition_bytes, Fchar_after, Fchar_before)
      (Finsert_buffer_substring, Fcompare_buffer_substrings)
      * src/fns.c (Fsecure_hash_algorithms):
      * src/font.c (Finternal_char_font, Ffont_at):
      * src/fringe.c (Ffringe_bitmaps_at_pos):
      * src/search.c (search_command):
      * src/textprop.c (get_char_property_and_overlay):
      * src/window.c (Fpos_visible_in_window_p):
      * src/xdisp.c (Fwindow_text_pixel_size):
      Use it instead of CHECK_FIXNUM_COERCE_MARKER, so that
      the code is simpler and treats bignums consistently with fixnums.
      * src/buffer.h (CHECK_FIXNUM_COERCE_MARKER): Define here
      rather than in lisp.h, and reimplement in terms of fix_position
      so that it treats bignums consistently with fixnums.
      * src/lisp.h (CHECK_FIXNUM_COERCE_MARKER): Move to buffer.h.
      * src/textprop.c (validate_interval_range): Signal with original
      bounds rather than modified ones.
  9. 17 Feb, 2020 1 commit
    • Paul Eggert's avatar
      Avoid unlikely load-average bug · 121f9bb1
      Paul Eggert authored
      * src/fns.c (Fload_average): Do not crash or return nonsense
      if the load average exceeds most-positive-fixnum/100 (Bug#39577).
  10. 18 Jan, 2020 1 commit
  11. 07 Jan, 2020 2 commits
    • Paul Eggert's avatar
      Fix sxhash-equal on bytecodes, markers, etc. · 724af767
      Paul Eggert authored
      Problem reported by Pip Cet (Bug#38912#14).
      * doc/lispref/objects.texi (Equality Predicates):
      Document better when ‘equal’ looks inside objects.
      * doc/lispref/windows.texi (Window Configurations):
      Don’t say that ‘equal’ looks inside window configurations.
      * etc/NEWS: Mention the change.
      * src/fns.c (internal_equal):
      Do not look inside window configurations.
      (sxhash_obj): Hash markers, byte-code function objects,
      char-tables, and font objects consistently with Fequal.
      * src/window.c (compare_window_configurations):
      Now static.  Remove last argument.  Caller changed.
      * test/lisp/ffap-tests.el (ffap-other-window--bug-25352):
      Use compare-window-configurations, not ‘equal’.
      * test/src/fns-tests.el (test-sxhash-equal): New test.
    • Paul Eggert's avatar
      Help the compiler inline sxhash · f950b078
      Paul Eggert authored
      * src/fns.c (sxhash_obj): Rename from sxhash and make
      it static, so that the compiler can inline it better.
      (sxhash): New function that does not take a depth arg.
      All callers changed.
  12. 01 Jan, 2020 1 commit
  13. 24 Dec, 2019 1 commit
  14. 26 Nov, 2019 1 commit
  15. 16 Oct, 2019 1 commit
  16. 10 Oct, 2019 1 commit
  17. 05 Oct, 2019 1 commit
  18. 04 Oct, 2019 1 commit
  19. 21 Sep, 2019 1 commit
  20. 20 Sep, 2019 1 commit
    • Stefan Kangas's avatar
      Recommend against SHA-1 and MD5 for security · 6d50010b
      Stefan Kangas authored
      * doc/lispref/text.texi (Checksum/Hash):
      * src/fns.c (Fmd5, Fsecure_hash):
      * lisp/subr.el (sha1): Doc fix to recommend against SHA-1 and MD5 for
      security-related applications, since they are not collision
      resistant.  (Bug#37420)
  21. 16 Sep, 2019 1 commit
    • Paul Eggert's avatar
      Remove obsolete Lint directives · 2c2f0eb9
      Paul Eggert authored
      Most of the directives were wrong anyway.  Apparently
      traditional lint hasn’t been used to check Emacs for years.
      * src/callint.c (Finteractive):
      * src/cm.c (evalcost):
      * src/emacs.c (main):
      * src/eval.c (call1, call2, call3, call4, call5, call6, call7, call8):
      * src/fns.c (concat2, concat3, nconc2):
      * src/term.c (calculate_ins_del_char_costs):
      Omit ARGSUSED comments.
      * src/eval.c (call1): Omit VARARGS comment.
  22. 24 Aug, 2019 1 commit
    • Paul Eggert's avatar
      extern function cleanup · b62eac0f
      Paul Eggert authored
      Most of these functions can be static.  A few are unused.
      * src/coding.c (encode_string_utf_8, decode_string_utf_8):
      Define only if ENABLE_UTF_8_CONVERTER_TEST, as they're
      not needed otherwise.
      * src/coding.c (encode_string_utf_8, decode_string_utf_8):
      * src/data.c (integer_mod):
      * src/fns.c (base64_encode_region_1, base64_encode_string_1):
      * src/ftfont.c (ftfont_get_fc_charset):
      Now static.
      * src/sysdep.c (verrprintf): Remove; unused.
  23. 22 Aug, 2019 3 commits
    • Paul Eggert's avatar
      Fix Qunbound-Qnil confusion in clrhash patch · e5defc3e
      Paul Eggert authored
      Problem reported by Stefan Monnier.
      * src/fns.c (hash_clear): Fix typo I introduced in my previous
      patch here, by setting keys to Qunbound not Qnil.
    • Paul Eggert's avatar
      Fix clrhash bug when hash table needs rehashing · ceebf3ef
      Paul Eggert authored
      Problem reported by Pip Cet in:
      * src/fns.c (maybe_resize_hash_table): Prefer ASET to gc_aset
      where either will do.  Simplify appending of Qunbound values.
      Put index_size calculation closer to where it’s needed.
      (hash_clear): If hash_rehash_needed_p (h), don’t clear the
      nonexistent hash vector.  Use memclear to speed up clearing.
      * src/lisp.h (HASH_TABLE_SIZE): Check that the size is positive,
      and tell that to the compiler.
    • Paul Eggert's avatar
      Don’t hard-loop on cycles in ‘read’ etc. · 951ea375
      Paul Eggert authored
      Problem for ‘read’ reported by Pip Cet in:
      * src/fns.c (Frequire): Protect against circular current-load-list.
      * src/lread.c (Fget_load_suffixes):
      Protect against circular load-suffixes or load-file-rep-suffixes.
      (Fload): Protect against circular loads-in-progress.
      (openp): Protect against circular PATH and SUFFIXES.
      (build_load_history): Protect against circular load-history or
      (readevalloop_eager_expand_eval): Protect against circular SUBFORMS.
      (read1): Protect against circular data.
      * test/src/lread-tests.el (lread-circular-hash): New test.
  24. 21 Aug, 2019 1 commit
    • Paul Eggert's avatar
      Be more careful about pointers to bignum vals · 39fee209
      Paul Eggert authored
      This uses ‘const’ to be better at catching bugs that
      mistakenly attempt to modify a bignum value.
      Lisp bignums are supposed to be immutable.
      * src/alloc.c (make_pure_bignum):
      * src/fns.c (sxhash_bignum):
      Accept Lisp_Object instead of struct Lisp_Bignum *, as that’s
      simpler now.  Caller changed.
      * src/bignum.h (bignum_val, xbignum_val): New inline functions.
      Prefer them to &i->value and XBIGNUM (i)->value, since they
      apply ‘const’ to the result.
      * src/timefns.c (lisp_to_timespec): Use mpz_t const *
      to point to a bignum value.
  25. 15 Aug, 2019 1 commit
    • Paul Eggert's avatar
      Debug out-of-range make_fixnum args · 3548fd8a
      Paul Eggert authored
      With --enable-checking, make_fixnum (N) now checks that N is
      in fixnum range.  Suggested by Pip Cet in:
      A new function make_ufixnum (N) is for the rare cases where N
      is intended to be unsigned and is in the range 0..INTMASK.
      * configure.ac (AC_C_TYPEOF): Add.
      (HAVE_STATEMENT_EXPRESSIONS): Resurrect this macro.
      * src/fns.c (Frandom, hashfn_eq, hashfn_equal, hashfn_user_defined):
      * src/profiler.c (hashfn_profiler):
      Use make_ufixnum rather than make_fixum, since the argument is
      an unsigned integer in the range 0..INTMASK rather than a signed
      Typically this is for hashes.
      * src/lisp.h (lisp_h_make_fixnum_wrap) [USE_LSB_TAG]:
      Rename from lisp_h_make_fixnum.
      (lisp_h_make_fixnum): Redefine in terms of lisp_h_make_fixnum_wrap.
      Check for fixnum overflow on compilers like GCC that
      have statement expressions and typeof.
      (FIXNUM_OVERFLOW_P): Move up.
      (make_fixnum): Check for fixnum overflow.
      (make_ufixnum): New function, which checks that the arg
      fits into 0..INTMASK range.
  26. 26 Jul, 2019 4 commits
  27. 23 Jul, 2019 3 commits
  28. 21 Jul, 2019 3 commits
    • Paul Eggert's avatar
      Avoid integer overflow in hash table size · c72e6328
      Paul Eggert authored
      * src/fns.c (INDEX_SIZE_BOUND): Use a tighter bound.
      (maybe_resize_hash_table): Avoid integer overflow when
      checking for hash table size overflow.  Fix confusion
      between INDEX_SIZE_BOUND (which is for the index vector)
      and hash table size.  Fix typo in debugging message
    • Paul Eggert's avatar
      Improve doc for hash tables · cf285946
      Paul Eggert authored
      * doc/lispref/hash.texi (Creating Hash, Defining Hash):
      * src/fns.c (Fsxhash_eq, Fsxhash_eql, Fsxhash_equal):
      Say that hashes are fixnums.
      (Fmake_hash_table): Say that that an integer rehash-size
      should be a fixnum.
      * doc/lispref/hash.texi (Defining Hash): Say that hash and
      comparison functions should be consistent and pure, and should
      return quickly.
    • Paul Eggert's avatar
      Tweak recent hash-table fix · 49e80e76
      Paul Eggert authored
      * src/fns.c (maybe_resize_hash_table): Completely initialize the
      new ‘next’ vector before allocating more vectors, as this
      preserves locality a bit better and it’s safer not to leave an
      uninitialized Lisp object around.  Use next_size instead of
      new_size to compute new index size.