diff options
| author | Dmitry Antipov | 2012-08-21 14:21:04 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2012-08-21 14:21:04 +0400 |
| commit | 086ca913a8495b1d4f0d7eae58aea75f2f5e44ae (patch) | |
| tree | 0eb5a3cb36efc4b1f2209dfa74be7d6fd3c1b034 /src | |
| parent | 0e733db9150ea50dc1a3687a0898d6264c4cabd8 (diff) | |
| download | emacs-086ca913a8495b1d4f0d7eae58aea75f2f5e44ae.tar.gz emacs-086ca913a8495b1d4f0d7eae58aea75f2f5e44ae.zip | |
Avoid direct writes to contents member of struct Lisp_Vector.
* lisp.h (vcopy): New function to copy data into vector.
* dispnew.c (Fframe_or_buffer_changed_p): Use AREF and ASET.
* fns.c (Ffillarray): Use ASET.
* keyboard.c (timer_check_2): Use AREF and ASET.
(append_tool_bar_item, Frecent_keys): Use vcopy.
* lread.c (read_vector): Use ASET.
* msdos.c (Frecent_doskeys): Use vcopy.
* xface.c (Finternal_copy_lisp_face): Use vcopy.
(Finternal_merge_in_global_face): Use ASET and vcopy.
* xfont.c (xfont_list_pattern): Likewise.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 14 | ||||
| -rw-r--r-- | src/dispnew.c | 63 | ||||
| -rw-r--r-- | src/fns.c | 8 | ||||
| -rw-r--r-- | src/keyboard.c | 20 | ||||
| -rw-r--r-- | src/lisp.h | 14 | ||||
| -rw-r--r-- | src/lread.c | 6 | ||||
| -rw-r--r-- | src/msdos.c | 8 | ||||
| -rw-r--r-- | src/xfaces.c | 9 | ||||
| -rw-r--r-- | src/xfont.c | 8 |
9 files changed, 86 insertions, 64 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 15eac722f8e..75853f3d354 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,17 @@ | |||
| 1 | 2012-08-21 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 2 | |||
| 3 | Avoid direct writes to contents member of struct Lisp_Vector. | ||
| 4 | * lisp.h (vcopy): New function to copy data into vector. | ||
| 5 | * dispnew.c (Fframe_or_buffer_changed_p): Use AREF and ASET. | ||
| 6 | * fns.c (Ffillarray): Use ASET. | ||
| 7 | * keyboard.c (timer_check_2): Use AREF and ASET. | ||
| 8 | (append_tool_bar_item, Frecent_keys): Use vcopy. | ||
| 9 | * lread.c (read_vector): Use ASET. | ||
| 10 | * msdos.c (Frecent_doskeys): Use vcopy. | ||
| 11 | * xface.c (Finternal_copy_lisp_face): Use vcopy. | ||
| 12 | (Finternal_merge_in_global_face): Use ASET and vcopy. | ||
| 13 | * xfont.c (xfont_list_pattern): Likewise. | ||
| 14 | |||
| 1 | 2012-08-21 Martin Rudalics <rudalics@gmx.at> | 15 | 2012-08-21 Martin Rudalics <rudalics@gmx.at> |
| 2 | 16 | ||
| 3 | * window.c (Fwindow_point): For the selected window always return | 17 | * window.c (Fwindow_point): For the selected window always return |
diff --git a/src/dispnew.c b/src/dispnew.c index 8db4f93dc70..ce7c4ebcb4c 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -6044,8 +6044,7 @@ pass nil for VARIABLE. */) | |||
| 6044 | (Lisp_Object variable) | 6044 | (Lisp_Object variable) |
| 6045 | { | 6045 | { |
| 6046 | Lisp_Object state, tail, frame, buf; | 6046 | Lisp_Object state, tail, frame, buf; |
| 6047 | Lisp_Object *vecp, *end; | 6047 | ptrdiff_t n, idx; |
| 6048 | ptrdiff_t n; | ||
| 6049 | 6048 | ||
| 6050 | if (! NILP (variable)) | 6049 | if (! NILP (variable)) |
| 6051 | { | 6050 | { |
| @@ -6057,18 +6056,16 @@ pass nil for VARIABLE. */) | |||
| 6057 | else | 6056 | else |
| 6058 | state = frame_and_buffer_state; | 6057 | state = frame_and_buffer_state; |
| 6059 | 6058 | ||
| 6060 | vecp = XVECTOR (state)->contents; | 6059 | idx = 0; |
| 6061 | end = vecp + ASIZE (state); | ||
| 6062 | |||
| 6063 | FOR_EACH_FRAME (tail, frame) | 6060 | FOR_EACH_FRAME (tail, frame) |
| 6064 | { | 6061 | { |
| 6065 | if (vecp == end) | 6062 | if (idx == ASIZE (state)) |
| 6066 | goto changed; | 6063 | goto changed; |
| 6067 | if (!EQ (*vecp++, frame)) | 6064 | if (!EQ (AREF (state, idx++), frame)) |
| 6068 | goto changed; | 6065 | goto changed; |
| 6069 | if (vecp == end) | 6066 | if (idx == ASIZE (state)) |
| 6070 | goto changed; | 6067 | goto changed; |
| 6071 | if (!EQ (*vecp++, XFRAME (frame)->name)) | 6068 | if (!EQ (AREF (state, idx++), XFRAME (frame)->name)) |
| 6072 | goto changed; | 6069 | goto changed; |
| 6073 | } | 6070 | } |
| 6074 | /* Check that the buffer info matches. */ | 6071 | /* Check that the buffer info matches. */ |
| @@ -6078,23 +6075,23 @@ pass nil for VARIABLE. */) | |||
| 6078 | /* Ignore buffers that aren't included in buffer lists. */ | 6075 | /* Ignore buffers that aren't included in buffer lists. */ |
| 6079 | if (SREF (BVAR (XBUFFER (buf), name), 0) == ' ') | 6076 | if (SREF (BVAR (XBUFFER (buf), name), 0) == ' ') |
| 6080 | continue; | 6077 | continue; |
| 6081 | if (vecp == end) | 6078 | if (idx == ASIZE (state)) |
| 6082 | goto changed; | 6079 | goto changed; |
| 6083 | if (!EQ (*vecp++, buf)) | 6080 | if (!EQ (AREF (state, idx++), buf)) |
| 6084 | goto changed; | 6081 | goto changed; |
| 6085 | if (vecp == end) | 6082 | if (idx == ASIZE (state)) |
| 6086 | goto changed; | 6083 | goto changed; |
| 6087 | if (!EQ (*vecp++, BVAR (XBUFFER (buf), read_only))) | 6084 | if (!EQ (AREF (state, idx++), BVAR (XBUFFER (buf), read_only))) |
| 6088 | goto changed; | 6085 | goto changed; |
| 6089 | if (vecp == end) | 6086 | if (idx == ASIZE (state)) |
| 6090 | goto changed; | 6087 | goto changed; |
| 6091 | if (!EQ (*vecp++, Fbuffer_modified_p (buf))) | 6088 | if (!EQ (AREF (state, idx++), Fbuffer_modified_p (buf))) |
| 6092 | goto changed; | 6089 | goto changed; |
| 6093 | } | 6090 | } |
| 6094 | if (vecp == end) | 6091 | if (idx == ASIZE (state)) |
| 6095 | goto changed; | 6092 | goto changed; |
| 6096 | /* Detect deletion of a buffer at the end of the list. */ | 6093 | /* Detect deletion of a buffer at the end of the list. */ |
| 6097 | if (EQ (*vecp, Qlambda)) | 6094 | if (EQ (AREF (state, idx), Qlambda)) |
| 6098 | return Qnil; | 6095 | return Qnil; |
| 6099 | 6096 | ||
| 6100 | /* Come here if we decide the data has changed. */ | 6097 | /* Come here if we decide the data has changed. */ |
| @@ -6121,11 +6118,13 @@ pass nil for VARIABLE. */) | |||
| 6121 | } | 6118 | } |
| 6122 | 6119 | ||
| 6123 | /* Record the new data in the (possibly reallocated) vector. */ | 6120 | /* Record the new data in the (possibly reallocated) vector. */ |
| 6124 | vecp = XVECTOR (state)->contents; | 6121 | idx = 0; |
| 6125 | FOR_EACH_FRAME (tail, frame) | 6122 | FOR_EACH_FRAME (tail, frame) |
| 6126 | { | 6123 | { |
| 6127 | *vecp++ = frame; | 6124 | ASET (state, idx, frame); |
| 6128 | *vecp++ = XFRAME (frame)->name; | 6125 | idx++; |
| 6126 | ASET (state, idx, XFRAME (frame)->name); | ||
| 6127 | idx++; | ||
| 6129 | } | 6128 | } |
| 6130 | for (tail = Vbuffer_alist; CONSP (tail); tail = XCDR (tail)) | 6129 | for (tail = Vbuffer_alist; CONSP (tail); tail = XCDR (tail)) |
| 6131 | { | 6130 | { |
| @@ -6133,19 +6132,23 @@ pass nil for VARIABLE. */) | |||
| 6133 | /* Ignore buffers that aren't included in buffer lists. */ | 6132 | /* Ignore buffers that aren't included in buffer lists. */ |
| 6134 | if (SREF (BVAR (XBUFFER (buf), name), 0) == ' ') | 6133 | if (SREF (BVAR (XBUFFER (buf), name), 0) == ' ') |
| 6135 | continue; | 6134 | continue; |
| 6136 | *vecp++ = buf; | 6135 | ASET (state, idx, buf); |
| 6137 | *vecp++ = BVAR (XBUFFER (buf), read_only); | 6136 | idx++; |
| 6138 | *vecp++ = Fbuffer_modified_p (buf); | 6137 | ASET (state, idx, BVAR (XBUFFER (buf), read_only)); |
| 6138 | idx++; | ||
| 6139 | ASET (state, idx, Fbuffer_modified_p (buf)); | ||
| 6140 | idx++; | ||
| 6139 | } | 6141 | } |
| 6140 | /* Fill up the vector with lambdas (always at least one). */ | 6142 | /* Fill up the vector with lambdas (always at least one). */ |
| 6141 | *vecp++ = Qlambda; | 6143 | ASET (state, idx, Qlambda); |
| 6142 | while (vecp - XVECTOR (state)->contents | 6144 | idx++; |
| 6143 | < ASIZE (state)) | 6145 | while (idx < ASIZE (state)) |
| 6144 | *vecp++ = Qlambda; | 6146 | { |
| 6147 | ASET (state, idx, Qlambda); | ||
| 6148 | idx++; | ||
| 6149 | } | ||
| 6145 | /* Make sure we didn't overflow the vector. */ | 6150 | /* Make sure we didn't overflow the vector. */ |
| 6146 | if (vecp - XVECTOR (state)->contents | 6151 | eassert (idx <= ASIZE (state)); |
| 6147 | > ASIZE (state)) | ||
| 6148 | abort (); | ||
| 6149 | return Qt; | 6152 | return Qt; |
| 6150 | } | 6153 | } |
| 6151 | 6154 | ||
| @@ -2139,12 +2139,8 @@ 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; |
diff --git a/src/keyboard.c b/src/keyboard.c index 868d0c8d2c1..3d4061accfc 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -4419,7 +4419,6 @@ timer_check_2 (void) | |||
| 4419 | 4419 | ||
| 4420 | while (CONSP (timers) || CONSP (idle_timers)) | 4420 | while (CONSP (timers) || CONSP (idle_timers)) |
| 4421 | { | 4421 | { |
| 4422 | Lisp_Object *vector; | ||
| 4423 | Lisp_Object timer = Qnil, idle_timer = Qnil; | 4422 | Lisp_Object timer = Qnil, idle_timer = Qnil; |
| 4424 | EMACS_TIME timer_time, idle_timer_time; | 4423 | EMACS_TIME timer_time, idle_timer_time; |
| 4425 | EMACS_TIME difference; | 4424 | EMACS_TIME difference; |
| @@ -4495,15 +4494,14 @@ timer_check_2 (void) | |||
| 4495 | /* If timer is ripe, run it if it hasn't been run. */ | 4494 | /* If timer is ripe, run it if it hasn't been run. */ |
| 4496 | if (ripe) | 4495 | if (ripe) |
| 4497 | { | 4496 | { |
| 4498 | vector = XVECTOR (chosen_timer)->contents; | 4497 | if (NILP (AREF (chosen_timer, 0))) |
| 4499 | if (NILP (vector[0])) | ||
| 4500 | { | 4498 | { |
| 4501 | ptrdiff_t count = SPECPDL_INDEX (); | 4499 | ptrdiff_t count = SPECPDL_INDEX (); |
| 4502 | Lisp_Object old_deactivate_mark = Vdeactivate_mark; | 4500 | Lisp_Object old_deactivate_mark = Vdeactivate_mark; |
| 4503 | 4501 | ||
| 4504 | /* Mark the timer as triggered to prevent problems if the lisp | 4502 | /* Mark the timer as triggered to prevent problems if the lisp |
| 4505 | code fails to reschedule it right. */ | 4503 | code fails to reschedule it right. */ |
| 4506 | vector[0] = Qt; | 4504 | ASET (chosen_timer, 0, Qt); |
| 4507 | 4505 | ||
| 4508 | specbind (Qinhibit_quit, Qt); | 4506 | specbind (Qinhibit_quit, Qt); |
| 4509 | 4507 | ||
| @@ -8447,7 +8445,6 @@ init_tool_bar_items (Lisp_Object reuse) | |||
| 8447 | static void | 8445 | static void |
| 8448 | append_tool_bar_item (void) | 8446 | append_tool_bar_item (void) |
| 8449 | { | 8447 | { |
| 8450 | Lisp_Object *to, *from; | ||
| 8451 | ptrdiff_t incr = | 8448 | ptrdiff_t incr = |
| 8452 | (ntool_bar_items | 8449 | (ntool_bar_items |
| 8453 | - (ASIZE (tool_bar_items_vector) - TOOL_BAR_ITEM_NSLOTS)); | 8450 | - (ASIZE (tool_bar_items_vector) - TOOL_BAR_ITEM_NSLOTS)); |
| @@ -8459,9 +8456,8 @@ append_tool_bar_item (void) | |||
| 8459 | 8456 | ||
| 8460 | /* Append entries from tool_bar_item_properties to the end of | 8457 | /* Append entries from tool_bar_item_properties to the end of |
| 8461 | tool_bar_items_vector. */ | 8458 | tool_bar_items_vector. */ |
| 8462 | to = XVECTOR (tool_bar_items_vector)->contents + ntool_bar_items; | 8459 | vcopy (tool_bar_items_vector, ntool_bar_items, |
| 8463 | from = XVECTOR (tool_bar_item_properties)->contents; | 8460 | XVECTOR (tool_bar_item_properties)->contents, TOOL_BAR_ITEM_NSLOTS); |
| 8464 | memcpy (to, from, TOOL_BAR_ITEM_NSLOTS * sizeof *to); | ||
| 8465 | ntool_bar_items += TOOL_BAR_ITEM_NSLOTS; | 8461 | ntool_bar_items += TOOL_BAR_ITEM_NSLOTS; |
| 8466 | } | 8462 | } |
| 8467 | 8463 | ||
| @@ -10490,10 +10486,10 @@ DEFUN ("recent-keys", Frecent_keys, Srecent_keys, 0, 0, 0, | |||
| 10490 | else | 10486 | else |
| 10491 | { | 10487 | { |
| 10492 | val = Fvector (NUM_RECENT_KEYS, keys); | 10488 | val = Fvector (NUM_RECENT_KEYS, keys); |
| 10493 | memcpy (XVECTOR (val)->contents, keys + recent_keys_index, | 10489 | vcopy (val, 0, keys + recent_keys_index, |
| 10494 | (NUM_RECENT_KEYS - recent_keys_index) * word_size); | 10490 | NUM_RECENT_KEYS - recent_keys_index); |
| 10495 | memcpy (XVECTOR (val)->contents + NUM_RECENT_KEYS - recent_keys_index, | 10491 | vcopy (val, NUM_RECENT_KEYS - recent_keys_index, |
| 10496 | keys, recent_keys_index * word_size); | 10492 | keys, recent_keys_index); |
| 10497 | return val; | 10493 | return val; |
| 10498 | } | 10494 | } |
| 10499 | } | 10495 | } |
diff --git a/src/lisp.h b/src/lisp.h index 3a6eb72d020..587e584b091 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -2344,6 +2344,20 @@ gc_aset (Lisp_Object array, ptrdiff_t idx, Lisp_Object val) | |||
| 2344 | XVECTOR (array)->contents[idx] = val; | 2344 | XVECTOR (array)->contents[idx] = val; |
| 2345 | } | 2345 | } |
| 2346 | 2346 | ||
| 2347 | /* Copy COUNT Lisp_Objects from ARGS to contents of V starting from OFFSET. */ | ||
| 2348 | |||
| 2349 | LISP_INLINE void | ||
| 2350 | vcopy (Lisp_Object v, ptrdiff_t offset, Lisp_Object *args, ptrdiff_t count) | ||
| 2351 | { | ||
| 2352 | ptrdiff_t i; | ||
| 2353 | |||
| 2354 | eassert (offset + count <= ASIZE (v)); | ||
| 2355 | for (i = 0; i < count; i++) | ||
| 2356 | ASET (v, offset + i, args[i]); | ||
| 2357 | } | ||
| 2358 | |||
| 2359 | /* Functions to modify hash tables. */ | ||
| 2360 | |||
| 2347 | LISP_INLINE void | 2361 | LISP_INLINE void |
| 2348 | set_hash_key_and_value (struct Lisp_Hash_Table *h, Lisp_Object key_and_value) | 2362 | set_hash_key_and_value (struct Lisp_Hash_Table *h, Lisp_Object key_and_value) |
| 2349 | { | 2363 | { |
diff --git a/src/lread.c b/src/lread.c index e2ad03b349f..f3ab1610d2c 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -3406,7 +3406,7 @@ read_vector (Lisp_Object readcharfun, int bytecodeflag) | |||
| 3406 | /* Delay handling the bytecode slot until we know whether | 3406 | /* Delay handling the bytecode slot until we know whether |
| 3407 | it is lazily-loaded (we can tell by whether the | 3407 | it is lazily-loaded (we can tell by whether the |
| 3408 | constants slot is nil). */ | 3408 | constants slot is nil). */ |
| 3409 | ptr[COMPILED_CONSTANTS] = item; | 3409 | ASET (vector, COMPILED_CONSTANTS, item); |
| 3410 | item = Qnil; | 3410 | item = Qnil; |
| 3411 | } | 3411 | } |
| 3412 | else if (i == COMPILED_CONSTANTS) | 3412 | else if (i == COMPILED_CONSTANTS) |
| @@ -3432,7 +3432,7 @@ read_vector (Lisp_Object readcharfun, int bytecodeflag) | |||
| 3432 | } | 3432 | } |
| 3433 | 3433 | ||
| 3434 | /* Now handle the bytecode slot. */ | 3434 | /* Now handle the bytecode slot. */ |
| 3435 | ptr[COMPILED_BYTECODE] = bytestr; | 3435 | ASET (vector, COMPILED_BYTECODE, bytestr); |
| 3436 | } | 3436 | } |
| 3437 | else if (i == COMPILED_DOC_STRING | 3437 | else if (i == COMPILED_DOC_STRING |
| 3438 | && STRINGP (item) | 3438 | && STRINGP (item) |
| @@ -3444,7 +3444,7 @@ read_vector (Lisp_Object readcharfun, int bytecodeflag) | |||
| 3444 | item = Fstring_as_multibyte (item); | 3444 | item = Fstring_as_multibyte (item); |
| 3445 | } | 3445 | } |
| 3446 | } | 3446 | } |
| 3447 | ptr[i] = item; | 3447 | ASET (vector, i, item); |
| 3448 | otem = XCONS (tem); | 3448 | otem = XCONS (tem); |
| 3449 | tem = Fcdr (tem); | 3449 | tem = Fcdr (tem); |
| 3450 | free_cons (otem); | 3450 | free_cons (otem); |
diff --git a/src/msdos.c b/src/msdos.c index 30435820d9e..a214456d104 100644 --- a/src/msdos.c +++ b/src/msdos.c | |||
| @@ -2434,10 +2434,10 @@ and then the scan code. */) | |||
| 2434 | else | 2434 | else |
| 2435 | { | 2435 | { |
| 2436 | val = Fvector (NUM_RECENT_DOSKEYS, keys); | 2436 | val = Fvector (NUM_RECENT_DOSKEYS, keys); |
| 2437 | memcpy (XVECTOR (val)->contents, keys + recent_doskeys_index, | 2437 | vcopy (val, 0, keys + recent_doskeys_index, |
| 2438 | (NUM_RECENT_DOSKEYS - recent_doskeys_index) * word_size); | 2438 | NUM_RECENT_DOSKEYS - recent_doskeys_index); |
| 2439 | memcpy (XVECTOR (val)->contents + NUM_RECENT_DOSKEYS - recent_doskeys_index, | 2439 | vcopy (val, NUM_RECENT_DOSKEYS - recent_doskeys_index, |
| 2440 | keys, recent_doskeys_index * word_size); | 2440 | keys, recent_doskeys_index); |
| 2441 | return val; | 2441 | return val; |
| 2442 | } | 2442 | } |
| 2443 | } | 2443 | } |
diff --git a/src/xfaces.c b/src/xfaces.c index 46121d66606..820d764d0a8 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -2781,8 +2781,7 @@ The value is TO. */) | |||
| 2781 | copy = Finternal_make_lisp_face (to, new_frame); | 2781 | copy = Finternal_make_lisp_face (to, new_frame); |
| 2782 | } | 2782 | } |
| 2783 | 2783 | ||
| 2784 | memcpy (XVECTOR (copy)->contents, XVECTOR (lface)->contents, | 2784 | vcopy (copy, 0, XVECTOR (lface)->contents, LFACE_VECTOR_SIZE); |
| 2785 | LFACE_VECTOR_SIZE * word_size); | ||
| 2786 | 2785 | ||
| 2787 | /* Changing a named face means that all realized faces depending on | 2786 | /* Changing a named face means that all realized faces depending on |
| 2788 | that face are invalid. Since we cannot tell which realized faces | 2787 | that face are invalid. Since we cannot tell which realized faces |
| @@ -3831,9 +3830,9 @@ Default face attributes override any local face attributes. */) | |||
| 3831 | gvec = XVECTOR (global_lface)->contents; | 3830 | gvec = XVECTOR (global_lface)->contents; |
| 3832 | for (i = 1; i < LFACE_VECTOR_SIZE; ++i) | 3831 | for (i = 1; i < LFACE_VECTOR_SIZE; ++i) |
| 3833 | if (IGNORE_DEFFACE_P (gvec[i])) | 3832 | if (IGNORE_DEFFACE_P (gvec[i])) |
| 3834 | lvec[i] = Qunspecified; | 3833 | ASET (local_lface, i, Qunspecified); |
| 3835 | else if (! UNSPECIFIEDP (gvec[i])) | 3834 | else if (! UNSPECIFIEDP (gvec[i])) |
| 3836 | lvec[i] = gvec[i]; | 3835 | ASET (local_lface, i, AREF (global_lface, i)); |
| 3837 | 3836 | ||
| 3838 | /* If the default face was changed, update the face cache and the | 3837 | /* If the default face was changed, update the face cache and the |
| 3839 | `font' frame parameter. */ | 3838 | `font' frame parameter. */ |
| @@ -3850,7 +3849,7 @@ Default face attributes override any local face attributes. */) | |||
| 3850 | the previously-cached vector. */ | 3849 | the previously-cached vector. */ |
| 3851 | memcpy (attrs, oldface->lface, sizeof attrs); | 3850 | memcpy (attrs, oldface->lface, sizeof attrs); |
| 3852 | merge_face_vectors (f, lvec, attrs, 0); | 3851 | merge_face_vectors (f, lvec, attrs, 0); |
| 3853 | memcpy (lvec, attrs, sizeof attrs); | 3852 | vcopy (local_lface, 0, attrs, LFACE_VECTOR_SIZE); |
| 3854 | newface = realize_face (c, lvec, DEFAULT_FACE_ID); | 3853 | newface = realize_face (c, lvec, DEFAULT_FACE_ID); |
| 3855 | 3854 | ||
| 3856 | if ((! UNSPECIFIEDP (gvec[LFACE_FAMILY_INDEX]) | 3855 | if ((! UNSPECIFIEDP (gvec[LFACE_FAMILY_INDEX]) |
diff --git a/src/xfont.c b/src/xfont.c index 072bce7bb0a..cbb24622ae9 100644 --- a/src/xfont.c +++ b/src/xfont.c | |||
| @@ -390,7 +390,7 @@ xfont_list_pattern (Display *display, const char *pattern, | |||
| 390 | Lisp_Object scripts = Qnil; | 390 | Lisp_Object scripts = Qnil; |
| 391 | 391 | ||
| 392 | for (i = 0; i < ASIZE (xfont_scratch_props); i++) | 392 | for (i = 0; i < ASIZE (xfont_scratch_props); i++) |
| 393 | props[i] = Qnil; | 393 | ASET (xfont_scratch_props, i, Qnil); |
| 394 | for (i = 0; i < num_fonts; i++) | 394 | for (i = 0; i < num_fonts; i++) |
| 395 | indices[i] = names[i]; | 395 | indices[i] = names[i]; |
| 396 | qsort (indices, num_fonts, sizeof (char *), compare_font_names); | 396 | qsort (indices, num_fonts, sizeof (char *), compare_font_names); |
| @@ -467,9 +467,9 @@ xfont_list_pattern (Display *display, const char *pattern, | |||
| 467 | word_size * 7) | 467 | word_size * 7) |
| 468 | || ! EQ (AREF (entity, FONT_SPACING_INDEX), props[7])) | 468 | || ! EQ (AREF (entity, FONT_SPACING_INDEX), props[7])) |
| 469 | { | 469 | { |
| 470 | memcpy (props, aref_addr (entity, FONT_FOUNDRY_INDEX), | 470 | vcopy (xfont_scratch_props, 0, |
| 471 | word_size * 7); | 471 | aref_addr (entity, FONT_FOUNDRY_INDEX), 7); |
| 472 | props[7] = AREF (entity, FONT_SPACING_INDEX); | 472 | ASET (xfont_scratch_props, 7, AREF (entity, FONT_SPACING_INDEX)); |
| 473 | scripts = xfont_supported_scripts (display, indices[i], | 473 | scripts = xfont_supported_scripts (display, indices[i], |
| 474 | xfont_scratch_props, encoding); | 474 | xfont_scratch_props, encoding); |
| 475 | } | 475 | } |