aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1993-05-16 22:31:04 +0000
committerRichard M. Stallman1993-05-16 22:31:04 +0000
commit9516fe943a05f036b42305626e68ae9ce3dd6d1c (patch)
tree08301c4a5c7cac3034fff0f33b297112f3a33207 /src
parenta48fc390191db99588f34bfc7c41f87e538cadca (diff)
downloademacs-9516fe943a05f036b42305626e68ae9ce3dd6d1c.tar.gz
emacs-9516fe943a05f036b42305626e68ae9ce3dd6d1c.zip
(compute_char_face): Pass 0 as EXTEND arg to overlays_at.
Try first with small overlay_vec, then use a big enough one.
Diffstat (limited to 'src')
-rw-r--r--src/xfaces.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/xfaces.c b/src/xfaces.c
index e450b3aa8e5..febafc8066a 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -136,6 +136,8 @@ int next_face_id;
136/* The number of the face to use to indicate the region. */ 136/* The number of the face to use to indicate the region. */
137int region_face; 137int region_face;
138 138
139/* This is what appears in a slot in a face to signify that the face
140 does not specify that display aspect. */
139#define FACE_DEFAULT (~0) 141#define FACE_DEFAULT (~0)
140 142
141Lisp_Object Qface, Qwindow, Qpriority; 143Lisp_Object Qface, Qwindow, Qpriority;
@@ -638,7 +640,6 @@ compute_char_face (f, w, pos, region_beg, region_end, endptr)
638 int i, j, noverlays; 640 int i, j, noverlays;
639 int facecode; 641 int facecode;
640 Lisp_Object *overlay_vec; 642 Lisp_Object *overlay_vec;
641 int len;
642 struct sortvec *sortvec; 643 struct sortvec *sortvec;
643 Lisp_Object frame; 644 Lisp_Object frame;
644 int endpos; 645 int endpos;
@@ -666,10 +667,23 @@ compute_char_face (f, w, pos, region_beg, region_end, endptr)
666 667
667 { 668 {
668 int next_overlay; 669 int next_overlay;
670 int len;
671
672 /* First try with room for 40 overlays. */
673 len = 40;
674 overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object));
675
676 noverlays = overlays_at (pos, 0, &overlay_vec, &len, &next_overlay);
677
678 /* If there are more than 40,
679 make enough space for all, and try again. */
680 if (noverlays > len)
681 {
682 len = noverlays;
683 overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object));
684 noverlays = overlays_at (pos, 0, &overlay_vec, &len, &next_overlay);
685 }
669 686
670 len = 10;
671 overlay_vec = (Lisp_Object *) xmalloc (len * sizeof (Lisp_Object));
672 noverlays = overlays_at (pos, &overlay_vec, &len, &next_overlay);
673 if (next_overlay < endpos) 687 if (next_overlay < endpos)
674 endpos = next_overlay; 688 endpos = next_overlay;
675 } 689 }
@@ -763,8 +777,6 @@ compute_char_face (f, w, pos, region_beg, region_end, endptr)
763 merge_faces (FRAME_FACES (f) [region_face], &face); 777 merge_faces (FRAME_FACES (f) [region_face], &face);
764 } 778 }
765 779
766 xfree (overlay_vec);
767
768 *endptr = endpos; 780 *endptr = endpos;
769 781
770 return intern_frame_face (f, &face); 782 return intern_frame_face (f, &face);