aboutsummaryrefslogtreecommitdiffstats
path: root/src/fns.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fns.c')
-rw-r--r--src/fns.c86
1 files changed, 41 insertions, 45 deletions
diff --git a/src/fns.c b/src/fns.c
index 039c208b0d3..3225fefc5e3 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -628,7 +628,7 @@ concat (ptrdiff_t nargs, Lisp_Object *args,
628 ptrdiff_t thislen_byte = SBYTES (this); 628 ptrdiff_t thislen_byte = SBYTES (this);
629 629
630 memcpy (SDATA (val) + toindex_byte, SDATA (this), SBYTES (this)); 630 memcpy (SDATA (val) + toindex_byte, SDATA (this), SBYTES (this));
631 if (string_get_intervals (this)) 631 if (string_intervals (this))
632 { 632 {
633 textprops[num_textprops].argnum = argnum; 633 textprops[num_textprops].argnum = argnum;
634 textprops[num_textprops].from = 0; 634 textprops[num_textprops].from = 0;
@@ -640,7 +640,7 @@ concat (ptrdiff_t nargs, Lisp_Object *args,
640 /* Copy a single-byte string to a multibyte string. */ 640 /* Copy a single-byte string to a multibyte string. */
641 else if (STRINGP (this) && STRINGP (val)) 641 else if (STRINGP (this) && STRINGP (val))
642 { 642 {
643 if (string_get_intervals (this)) 643 if (string_intervals (this))
644 { 644 {
645 textprops[num_textprops].argnum = argnum; 645 textprops[num_textprops].argnum = argnum;
646 textprops[num_textprops].from = 0; 646 textprops[num_textprops].from = 0;
@@ -1060,7 +1060,7 @@ If you're not sure, whether to use `string-as-multibyte' or
1060 str_as_multibyte (SDATA (new_string), nbytes, 1060 str_as_multibyte (SDATA (new_string), nbytes,
1061 SBYTES (string), NULL); 1061 SBYTES (string), NULL);
1062 string = new_string; 1062 string = new_string;
1063 string_set_intervals (string, NULL); 1063 set_string_intervals (string, NULL);
1064 } 1064 }
1065 return string; 1065 return string;
1066} 1066}
@@ -2139,19 +2139,15 @@ ARRAY is a vector, string, char-table, or bool-vector. */)
2139 register ptrdiff_t size, idx; 2139 register ptrdiff_t size, idx;
2140 2140
2141 if (VECTORP (array)) 2141 if (VECTORP (array))
2142 { 2142 for (idx = 0, size = ASIZE (array); idx < size; idx++)
2143 register Lisp_Object *p = XVECTOR (array)->contents; 2143 ASET (array, idx, item);
2144 size = ASIZE (array);
2145 for (idx = 0; idx < size; idx++)
2146 p[idx] = item;
2147 }
2148 else if (CHAR_TABLE_P (array)) 2144 else if (CHAR_TABLE_P (array))
2149 { 2145 {
2150 int i; 2146 int i;
2151 2147
2152 for (i = 0; i < (1 << CHARTAB_SIZE_BITS_0); i++) 2148 for (i = 0; i < (1 << CHARTAB_SIZE_BITS_0); i++)
2153 char_table_set_contents (array, i, item); 2149 set_char_table_contents (array, i, item);
2154 CSET (XCHAR_TABLE (array), defalt, item); 2150 set_char_table_defalt (array, item);
2155 } 2151 }
2156 else if (STRINGP (array)) 2152 else if (STRINGP (array))
2157 { 2153 {
@@ -3663,7 +3659,7 @@ make_hash_table (Lisp_Object test, Lisp_Object size, Lisp_Object rehash_size,
3663 3659
3664 /* Set up the free list. */ 3660 /* Set up the free list. */
3665 for (i = 0; i < sz - 1; ++i) 3661 for (i = 0; i < sz - 1; ++i)
3666 set_hash_next (h, i, make_number (i + 1)); 3662 set_hash_next_slot (h, i, make_number (i + 1));
3667 h->next_free = make_number (0); 3663 h->next_free = make_number (0);
3668 3664
3669 XSET_HASH_TABLE (table, h); 3665 XSET_HASH_TABLE (table, h);
@@ -3760,17 +3756,17 @@ maybe_resize_hash_table (struct Lisp_Hash_Table *h)
3760 } 3756 }
3761#endif 3757#endif
3762 3758
3763 h->key_and_value = larger_vector (h->key_and_value, 3759 set_hash_key_and_value (h, larger_vector (h->key_and_value,
3764 2 * (new_size - old_size), -1); 3760 2 * (new_size - old_size), -1));
3765 h->next = larger_vector (h->next, new_size - old_size, -1); 3761 set_hash_next (h, larger_vector (h->next, new_size - old_size, -1));
3766 h->hash = larger_vector (h->hash, new_size - old_size, -1); 3762 set_hash_hash (h, larger_vector (h->hash, new_size - old_size, -1));
3767 h->index = Fmake_vector (make_number (index_size), Qnil); 3763 set_hash_index (h, Fmake_vector (make_number (index_size), Qnil));
3768 3764
3769 /* Update the free list. Do it so that new entries are added at 3765 /* Update the free list. Do it so that new entries are added at
3770 the end of the free list. This makes some operations like 3766 the end of the free list. This makes some operations like
3771 maphash faster. */ 3767 maphash faster. */
3772 for (i = old_size; i < new_size - 1; ++i) 3768 for (i = old_size; i < new_size - 1; ++i)
3773 set_hash_next (h, i, make_number (i + 1)); 3769 set_hash_next_slot (h, i, make_number (i + 1));
3774 3770
3775 if (!NILP (h->next_free)) 3771 if (!NILP (h->next_free))
3776 { 3772 {
@@ -3781,7 +3777,7 @@ maybe_resize_hash_table (struct Lisp_Hash_Table *h)
3781 !NILP (next)) 3777 !NILP (next))
3782 last = next; 3778 last = next;
3783 3779
3784 set_hash_next (h, XFASTINT (last), make_number (old_size)); 3780 set_hash_next_slot (h, XFASTINT (last), make_number (old_size));
3785 } 3781 }
3786 else 3782 else
3787 XSETFASTINT (h->next_free, old_size); 3783 XSETFASTINT (h->next_free, old_size);
@@ -3792,8 +3788,8 @@ maybe_resize_hash_table (struct Lisp_Hash_Table *h)
3792 { 3788 {
3793 EMACS_UINT hash_code = XUINT (HASH_HASH (h, i)); 3789 EMACS_UINT hash_code = XUINT (HASH_HASH (h, i));
3794 ptrdiff_t start_of_bucket = hash_code % ASIZE (h->index); 3790 ptrdiff_t start_of_bucket = hash_code % ASIZE (h->index);
3795 set_hash_next (h, i, HASH_INDEX (h, start_of_bucket)); 3791 set_hash_next_slot (h, i, HASH_INDEX (h, start_of_bucket));
3796 set_hash_index (h, start_of_bucket, make_number (i)); 3792 set_hash_index_slot (h, start_of_bucket, make_number (i));
3797 } 3793 }
3798 } 3794 }
3799} 3795}
@@ -3852,16 +3848,16 @@ hash_put (struct Lisp_Hash_Table *h, Lisp_Object key, Lisp_Object value,
3852 /* Store key/value in the key_and_value vector. */ 3848 /* Store key/value in the key_and_value vector. */
3853 i = XFASTINT (h->next_free); 3849 i = XFASTINT (h->next_free);
3854 h->next_free = HASH_NEXT (h, i); 3850 h->next_free = HASH_NEXT (h, i);
3855 set_hash_key (h, i, key); 3851 set_hash_key_slot (h, i, key);
3856 set_hash_value (h, i, value); 3852 set_hash_value_slot (h, i, value);
3857 3853
3858 /* Remember its hash code. */ 3854 /* Remember its hash code. */
3859 set_hash_hash (h, i, make_number (hash)); 3855 set_hash_hash_slot (h, i, make_number (hash));
3860 3856
3861 /* Add new entry to its collision chain. */ 3857 /* Add new entry to its collision chain. */
3862 start_of_bucket = hash % ASIZE (h->index); 3858 start_of_bucket = hash % ASIZE (h->index);
3863 set_hash_next (h, i, HASH_INDEX (h, start_of_bucket)); 3859 set_hash_next_slot (h, i, HASH_INDEX (h, start_of_bucket));
3864 set_hash_index (h, start_of_bucket, make_number (i)); 3860 set_hash_index_slot (h, start_of_bucket, make_number (i));
3865 return i; 3861 return i;
3866} 3862}
3867 3863
@@ -3892,16 +3888,16 @@ hash_remove_from_table (struct Lisp_Hash_Table *h, Lisp_Object key)
3892 { 3888 {
3893 /* Take entry out of collision chain. */ 3889 /* Take entry out of collision chain. */
3894 if (NILP (prev)) 3890 if (NILP (prev))
3895 set_hash_index (h, start_of_bucket, HASH_NEXT (h, i)); 3891 set_hash_index_slot (h, start_of_bucket, HASH_NEXT (h, i));
3896 else 3892 else
3897 set_hash_next (h, XFASTINT (prev), HASH_NEXT (h, i)); 3893 set_hash_next_slot (h, XFASTINT (prev), HASH_NEXT (h, i));
3898 3894
3899 /* Clear slots in key_and_value and add the slots to 3895 /* Clear slots in key_and_value and add the slots to
3900 the free list. */ 3896 the free list. */
3901 set_hash_key (h, i, Qnil); 3897 set_hash_key_slot (h, i, Qnil);
3902 set_hash_value (h, i, Qnil); 3898 set_hash_value_slot (h, i, Qnil);
3903 set_hash_hash (h, i, Qnil); 3899 set_hash_hash_slot (h, i, Qnil);
3904 set_hash_next (h, i, h->next_free); 3900 set_hash_next_slot (h, i, h->next_free);
3905 h->next_free = make_number (i); 3901 h->next_free = make_number (i);
3906 h->count--; 3902 h->count--;
3907 eassert (h->count >= 0); 3903 eassert (h->count >= 0);
@@ -3927,10 +3923,10 @@ hash_clear (struct Lisp_Hash_Table *h)
3927 3923
3928 for (i = 0; i < size; ++i) 3924 for (i = 0; i < size; ++i)
3929 { 3925 {
3930 set_hash_next (h, i, i < size - 1 ? make_number (i + 1) : Qnil); 3926 set_hash_next_slot (h, i, i < size - 1 ? make_number (i + 1) : Qnil);
3931 set_hash_key (h, i, Qnil); 3927 set_hash_key_slot (h, i, Qnil);
3932 set_hash_value (h, i, Qnil); 3928 set_hash_value_slot (h, i, Qnil);
3933 set_hash_hash (h, i, Qnil); 3929 set_hash_hash_slot (h, i, Qnil);
3934 } 3930 }
3935 3931
3936 for (i = 0; i < ASIZE (h->index); ++i) 3932 for (i = 0; i < ASIZE (h->index); ++i)
@@ -3971,8 +3967,8 @@ sweep_weak_table (struct Lisp_Hash_Table *h, int remove_entries_p)
3971 for (idx = HASH_INDEX (h, bucket); !NILP (idx); idx = next) 3967 for (idx = HASH_INDEX (h, bucket); !NILP (idx); idx = next)
3972 { 3968 {
3973 ptrdiff_t i = XFASTINT (idx); 3969 ptrdiff_t i = XFASTINT (idx);
3974 int key_known_to_survive_p = survives_gc_p (HASH_KEY (h, i)); 3970 bool key_known_to_survive_p = survives_gc_p (HASH_KEY (h, i));
3975 int value_known_to_survive_p = survives_gc_p (HASH_VALUE (h, i)); 3971 bool value_known_to_survive_p = survives_gc_p (HASH_VALUE (h, i));
3976 int remove_p; 3972 int remove_p;
3977 3973
3978 if (EQ (h->weak, Qkey)) 3974 if (EQ (h->weak, Qkey))
@@ -3994,18 +3990,18 @@ sweep_weak_table (struct Lisp_Hash_Table *h, int remove_entries_p)
3994 { 3990 {
3995 /* Take out of collision chain. */ 3991 /* Take out of collision chain. */
3996 if (NILP (prev)) 3992 if (NILP (prev))
3997 set_hash_index (h, bucket, next); 3993 set_hash_index_slot (h, bucket, next);
3998 else 3994 else
3999 set_hash_next (h, XFASTINT (prev), next); 3995 set_hash_next_slot (h, XFASTINT (prev), next);
4000 3996
4001 /* Add to free list. */ 3997 /* Add to free list. */
4002 set_hash_next (h, i, h->next_free); 3998 set_hash_next_slot (h, i, h->next_free);
4003 h->next_free = idx; 3999 h->next_free = idx;
4004 4000
4005 /* Clear key, value, and hash. */ 4001 /* Clear key, value, and hash. */
4006 set_hash_key (h, i, Qnil); 4002 set_hash_key_slot (h, i, Qnil);
4007 set_hash_value (h, i, Qnil); 4003 set_hash_value_slot (h, i, Qnil);
4008 set_hash_hash (h, i, Qnil); 4004 set_hash_hash_slot (h, i, Qnil);
4009 4005
4010 h->count--; 4006 h->count--;
4011 } 4007 }
@@ -4512,7 +4508,7 @@ VALUE. In any case, return VALUE. */)
4512 4508
4513 i = hash_lookup (h, key, &hash); 4509 i = hash_lookup (h, key, &hash);
4514 if (i >= 0) 4510 if (i >= 0)
4515 set_hash_value (h, i, value); 4511 set_hash_value_slot (h, i, value);
4516 else 4512 else
4517 hash_put (h, key, value, hash); 4513 hash_put (h, key, value, hash);
4518 4514