diff options
| author | Eli Zaretskii | 2019-01-28 22:03:05 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2019-01-28 22:03:05 +0200 |
| commit | 9d8f900d93c196cd1048cdbad12e08da7a38a604 (patch) | |
| tree | cc3b65d6b2dea7c95dad6e2ed01ebfd1585dceb4 /src | |
| parent | 0c9bce3fc490d6f5e935883e9690871cce4f9150 (diff) | |
| download | emacs-9d8f900d93c196cd1048cdbad12e08da7a38a604.tar.gz emacs-9d8f900d93c196cd1048cdbad12e08da7a38a604.zip | |
Fix last change in xfaces.c
* src/xfaces.c (init_xfaces): Don't rely of 'face'
property of a face to be a natural number.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xfaces.c | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/src/xfaces.c b/src/xfaces.c index 7facb13b76c..3ba824b6517 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -6520,28 +6520,19 @@ init_xfaces (void) | |||
| 6520 | { | 6520 | { |
| 6521 | if (CONSP (Vface_new_frame_defaults)) | 6521 | if (CONSP (Vface_new_frame_defaults)) |
| 6522 | { | 6522 | { |
| 6523 | Lisp_Object lface = XCAR (Vface_new_frame_defaults); | 6523 | /* Allocate the lface_id_to_name[] array. */ |
| 6524 | if (CONSP (lface)) | 6524 | lface_id_to_name_size = next_lface_id = |
| 6525 | XFIXNAT (Flength (Vface_new_frame_defaults)); | ||
| 6526 | lface_id_to_name = xnmalloc (next_lface_id, sizeof *lface_id_to_name); | ||
| 6527 | |||
| 6528 | /* Store the faces. */ | ||
| 6529 | Lisp_Object tail; | ||
| 6530 | int i = next_lface_id - 1; | ||
| 6531 | for (tail = Vface_new_frame_defaults; CONSP (tail); tail = XCDR (tail)) | ||
| 6525 | { | 6532 | { |
| 6526 | /* The first face in the list is the last face defined | 6533 | Lisp_Object lface = XCAR (tail); |
| 6527 | during loadup. Compute how many faces are there, and | 6534 | eassert (i >= 0); |
| 6528 | allocate the lface_id_to_name[] array. */ | 6535 | lface_id_to_name[i--] = XCAR (lface); |
| 6529 | Lisp_Object lface_id = Fget (XCAR (lface), Qface); | ||
| 6530 | lface_id_to_name_size = next_lface_id = XFIXNAT (lface_id) + 1; | ||
| 6531 | lface_id_to_name = xnmalloc (next_lface_id, sizeof *lface_id_to_name); | ||
| 6532 | /* Store the last face. */ | ||
| 6533 | lface_id_to_name[next_lface_id - 1] = lface; | ||
| 6534 | |||
| 6535 | /* Store the rest of the faces. */ | ||
| 6536 | Lisp_Object tail; | ||
| 6537 | for (tail = XCDR (Vface_new_frame_defaults); CONSP (tail); | ||
| 6538 | tail = XCDR (tail)) | ||
| 6539 | { | ||
| 6540 | lface = XCAR (tail); | ||
| 6541 | int face_id = XFIXNAT (Fget (XCAR (lface), Qface)); | ||
| 6542 | eassert (face_id < lface_id_to_name_size); | ||
| 6543 | lface_id_to_name[face_id] = lface; | ||
| 6544 | } | ||
| 6545 | } | 6536 | } |
| 6546 | } | 6537 | } |
| 6547 | } | 6538 | } |