comparison src/alloc.c @ 92109:4d9fc08769fa

Consolidate the image_cache to the terminal struct. * termhooks.h (P_): Remove redundant def. (struct terminal): New field `image_cache'. * frame.h (FRAME_IMAGE_CACHE): New macro. Use it everywhere in place of FRAME_X_IMAGE_CACHE. * xterm.h (struct x_display_info): Remove image_cache field. (FRAME_X_IMAGE_CACHE): Remove. Use FRAME_IMAGE_CACHE instead. * w32term.h (struct w32_display_info): Remove image_cache field. (FRAME_X_IMAGE_CACHE): Remove. Use FRAME_IMAGE_CACHE instead. * macterm.h (struct mac_display_info): Remove image_cache field. (FRAME_X_IMAGE_CACHE): Remove. Use FRAME_IMAGE_CACHE instead. * xterm.c (x_term_init): * w32term.c (w32_term_init): * macterm.c (mac_term_init): Set the image_cache in the terminal. * dispextern.h (clear_image_cache, forall_images_in_image_cache): Remove declarations. (clear_image_caches, mark_image_cache): New declarations. * xfaces.c (clear_face_cache): * xdisp.c (redisplay_internal): Use clear_image_caches. * image.c (clear_image_cache): Don't check that a frame is on a window-system before checking if it shares the same cache. (clear_image_caches): New function. (Fclear_image_cache): Use it. (mark_image): Move from allo.c. (mark_image_cache): Move from alloc.c and forall_images_in_image_cache. * alloc.c (mark_image, mark_image_cache): Move to image.c. (mark_object): Don't call mark_image_cache for frames. (mark_terminals): Call mark_image_cache.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Fri, 22 Feb 2008 17:42:09 +0000
parents d097bc79fdfb
children ca9efc5939fc
comparison
equal deleted inserted replaced
92108:fc5344b71cdb 92109:4d9fc08769fa
351 static void mark_glyph_matrix P_ ((struct glyph_matrix *)); 351 static void mark_glyph_matrix P_ ((struct glyph_matrix *));
352 static void mark_face_cache P_ ((struct face_cache *)); 352 static void mark_face_cache P_ ((struct face_cache *));
353 353
354 #ifdef HAVE_WINDOW_SYSTEM 354 #ifdef HAVE_WINDOW_SYSTEM
355 extern void mark_fringe_data P_ ((void)); 355 extern void mark_fringe_data P_ ((void));
356 static void mark_image P_ ((struct image *));
357 static void mark_image_cache P_ ((struct frame *));
358 #endif /* HAVE_WINDOW_SYSTEM */ 356 #endif /* HAVE_WINDOW_SYSTEM */
359 357
360 static struct Lisp_String *allocate_string P_ ((void)); 358 static struct Lisp_String *allocate_string P_ ((void));
361 static void compact_small_strings P_ ((void)); 359 static void compact_small_strings P_ ((void));
362 static void free_large_strings P_ ((void)); 360 static void free_large_strings P_ ((void));
5322 } 5320 }
5323 } 5321 }
5324 } 5322 }
5325 5323
5326 5324
5327 #ifdef HAVE_WINDOW_SYSTEM
5328
5329 /* Mark Lisp objects in image IMG. */
5330
5331 static void
5332 mark_image (img)
5333 struct image *img;
5334 {
5335 mark_object (img->spec);
5336
5337 if (!NILP (img->data.lisp_val))
5338 mark_object (img->data.lisp_val);
5339 }
5340
5341
5342 /* Mark Lisp objects in image cache of frame F. It's done this way so
5343 that we don't have to include xterm.h here. */
5344
5345 static void
5346 mark_image_cache (f)
5347 struct frame *f;
5348 {
5349 forall_images_in_image_cache (f, mark_image);
5350 }
5351
5352 #endif /* HAVE_X_WINDOWS */
5353
5354
5355 5325
5356 /* Mark reference to a Lisp_Object. 5326 /* Mark reference to a Lisp_Object.
5357 If the object referred to has not been seen yet, recursively mark 5327 If the object referred to has not been seen yet, recursively mark
5358 all the references contained in it. */ 5328 all the references contained in it. */
5359 5329
5518 } 5488 }
5519 else if (FRAMEP (obj)) 5489 else if (FRAMEP (obj))
5520 { 5490 {
5521 register struct frame *ptr = XFRAME (obj); 5491 register struct frame *ptr = XFRAME (obj);
5522 if (mark_vectorlike (XVECTOR (obj))) 5492 if (mark_vectorlike (XVECTOR (obj)))
5523 { 5493 mark_face_cache (ptr->face_cache);
5524 mark_face_cache (ptr->face_cache);
5525 #ifdef HAVE_WINDOW_SYSTEM
5526 mark_image_cache (ptr);
5527 #endif /* HAVE_WINDOW_SYSTEM */
5528 }
5529 } 5494 }
5530 else if (WINDOWP (obj)) 5495 else if (WINDOWP (obj))
5531 { 5496 {
5532 register struct Lisp_Vector *ptr = XVECTOR (obj); 5497 register struct Lisp_Vector *ptr = XVECTOR (obj);
5533 struct window *w = XWINDOW (obj); 5498 struct window *w = XWINDOW (obj);
5758 { 5723 {
5759 struct terminal *t; 5724 struct terminal *t;
5760 for (t = terminal_list; t; t = t->next_terminal) 5725 for (t = terminal_list; t; t = t->next_terminal)
5761 { 5726 {
5762 eassert (t->name != NULL); 5727 eassert (t->name != NULL);
5728 #ifdef HAVE_WINDOW_SYSTEM
5729 mark_image_cache (t->image_cache);
5730 #endif /* HAVE_WINDOW_SYSTEM */
5763 mark_vectorlike ((struct Lisp_Vector *)t); 5731 mark_vectorlike ((struct Lisp_Vector *)t);
5764 } 5732 }
5765 } 5733 }
5766 5734
5767 5735