aboutsummaryrefslogtreecommitdiffstats
path: root/src/ftxfont.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ftxfont.c')
-rw-r--r--src/ftxfont.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/src/ftxfont.c b/src/ftxfont.c
index 53f2616bb62..63e3477ebf4 100644
--- a/src/ftxfont.c
+++ b/src/ftxfont.c
@@ -59,7 +59,7 @@ ftxfont_get_gcs (struct frame *f, unsigned long foreground, unsigned long backgr
59 XColor color; 59 XColor color;
60 XGCValues xgcv; 60 XGCValues xgcv;
61 int i; 61 int i;
62 struct ftxfont_frame_data *data = font_get_frame_data (f, &ftxfont_driver); 62 struct ftxfont_frame_data *data = font_get_frame_data (f, Qftx);
63 struct ftxfont_frame_data *prev = NULL, *this = NULL, *new; 63 struct ftxfont_frame_data *prev = NULL, *this = NULL, *new;
64 64
65 if (data) 65 if (data)
@@ -78,19 +78,11 @@ ftxfont_get_gcs (struct frame *f, unsigned long foreground, unsigned long backgr
78 } 78 }
79 } 79 }
80 80
81 new = malloc (sizeof *new); 81 new = xmalloc (sizeof *new);
82 if (! new)
83 return NULL;
84 new->next = this; 82 new->next = this;
85 if (prev) 83 if (prev)
86 {
87 prev->next = new; 84 prev->next = new;
88 } 85 font_put_frame_data (f, Qftx, new);
89 else if (font_put_frame_data (f, &ftxfont_driver, new) < 0)
90 {
91 free (new);
92 return NULL;
93 }
94 86
95 new->colors[0].pixel = background; 87 new->colors[0].pixel = background;
96 new->colors[1].pixel = foreground; 88 new->colors[1].pixel = foreground;
@@ -123,8 +115,8 @@ ftxfont_get_gcs (struct frame *f, unsigned long foreground, unsigned long backgr
123 if (prev) 115 if (prev)
124 prev->next = new->next; 116 prev->next = new->next;
125 else if (data) 117 else if (data)
126 font_put_frame_data (f, &ftxfont_driver, new->next); 118 font_put_frame_data (f, Qftx, new->next);
127 free (new); 119 xfree (new);
128 return NULL; 120 return NULL;
129 } 121 }
130 return new->gcs; 122 return new->gcs;
@@ -337,7 +329,7 @@ ftxfont_draw (struct glyph_string *s, int from, int to, int x, int y,
337static int 329static int
338ftxfont_end_for_frame (struct frame *f) 330ftxfont_end_for_frame (struct frame *f)
339{ 331{
340 struct ftxfont_frame_data *data = font_get_frame_data (f, &ftxfont_driver); 332 struct ftxfont_frame_data *data = font_get_frame_data (f, Qftx);
341 333
342 block_input (); 334 block_input ();
343 while (data) 335 while (data)
@@ -347,11 +339,11 @@ ftxfont_end_for_frame (struct frame *f)
347 339
348 for (i = 0; i < 6; i++) 340 for (i = 0; i < 6; i++)
349 XFreeGC (FRAME_X_DISPLAY (f), data->gcs[i]); 341 XFreeGC (FRAME_X_DISPLAY (f), data->gcs[i]);
350 free (data); 342 xfree (data);
351 data = next; 343 data = next;
352 } 344 }
353 unblock_input (); 345 unblock_input ();
354 font_put_frame_data (f, &ftxfont_driver, NULL); 346 font_put_frame_data (f, Qftx, NULL);
355 return 0; 347 return 0;
356} 348}
357 349