summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2020-08-11 10:29:02 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2020-08-11 10:30:05 -0700
commit669aeafbd14b0ebb824bacba0a6b3daad30847a9 (patch)
treeb2f9c917f17fcced6833d2e6e29a0f7f45cc6e83
parentb5b7f6eb88d6588f6150c34e1405457f062538bb (diff)
downloademacs-669aeafbd14b0ebb824bacba0a6b3daad30847a9.tar.gz
emacs-669aeafbd14b0ebb824bacba0a6b3daad30847a9.tar.bz2
emacs-669aeafbd14b0ebb824bacba0a6b3daad30847a9.zip
Prefer make_nil_vector to make-vector with nil
* src/pdumper.c (hash_table_thaw): Pacify -Wconversion so we can use make_nil_vector again. * src/timefns.c (syms_of_timefns): Prefer make_nil_vector to make_vector with Qnil.
-rw-r--r--src/lisp.h3
-rw-r--r--src/pdumper.c4
-rw-r--r--src/timefns.c2
3 files changed, 6 insertions, 3 deletions
diff --git a/src/lisp.h b/src/lisp.h
index d88038d91be..2962babb4fe 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3947,7 +3947,8 @@ make_uninit_sub_char_table (int depth, int min_char)
return v;
}
-/* Make a vector of SIZE nils. */
+/* Make a vector of SIZE nils - faster than make_vector (size, Qnil)
+ if the OS already cleared the new memory. */
INLINE Lisp_Object
make_nil_vector (ptrdiff_t size)
diff --git a/src/pdumper.c b/src/pdumper.c
index 6c581bcd0bc..aaa760d70d2 100644
--- a/src/pdumper.c
+++ b/src/pdumper.c
@@ -2664,7 +2664,9 @@ static void
hash_table_thaw (Lisp_Object hash)
{
struct Lisp_Hash_Table *h = XHASH_TABLE (hash);
- h->hash = Fmake_vector (h->hash, Qnil);
+ ALLOW_IMPLICIT_CONVERSION;
+ h->hash = make_nil_vector (XFIXNUM (h->hash));
+ DISALLOW_IMPLICIT_CONVERSION;
h->next = Fmake_vector (h->next, make_fixnum (-1));
h->index = Fmake_vector (h->index, make_fixnum (-1));
diff --git a/src/timefns.c b/src/timefns.c
index 7bcc37d7c1e..94cfddf0da9 100644
--- a/src/timefns.c
+++ b/src/timefns.c
@@ -2048,7 +2048,7 @@ syms_of_timefns (void)
defsubr (&Scurrent_time_zone);
defsubr (&Sset_time_zone_rule);
- flt_radix_power = make_vector (flt_radix_power_size, Qnil);
+ flt_radix_power = make_nil_vector (flt_radix_power_size);
staticpro (&flt_radix_power);
#ifdef NEED_ZTRILLION_INIT