emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r104558: Cruft removal in struct imag


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r104558: Cruft removal in struct image.
Date: Fri, 10 Jun 2011 21:48:59 -0400
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 104558
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Fri 2011-06-10 21:48:59 -0400
message:
  Cruft removal in struct image.
  
  * src/dispextern.h (struct image): Replace data member, whose int_val
  and ptr_val fields were not used by anything, with a single
  lisp_val object.
  
  * src/image.c (Fimage_metadata, make_image, mark_image, tiff_load)
  (gif_clear_image, gif_load, imagemagick_load_image)
  (gs_clear_image, gs_load): Callers changed.
modified:
  src/ChangeLog
  src/dispextern.h
  src/image.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2011-06-10 20:52:30 +0000
+++ b/src/ChangeLog     2011-06-11 01:48:59 +0000
@@ -1,3 +1,13 @@
+2011-06-11  Chong Yidong  <address@hidden>
+
+       * dispextern.h (struct image): Replace data member, whose int_val
+       and ptr_val fields were not used by anything, with a single
+       lisp_val object.
+
+       * image.c (Fimage_metadata, make_image, mark_image, tiff_load)
+       (gif_clear_image, gif_load, imagemagick_load_image)
+       (gs_clear_image, gs_load): Callers changed.
+
 2011-06-10  Paul Eggert  <address@hidden>
 
        * buffer.h: Include <time.h>, for time_t.

=== modified file 'src/dispextern.h'
--- a/src/dispextern.h  2011-06-04 07:41:44 +0000
+++ b/src/dispextern.h  2011-06-11 01:48:59 +0000
@@ -2792,16 +2792,9 @@
   /* 1 means that loading the image failed.  Don't try again.  */
   unsigned load_failed_p;
 
-  /* A place for image types to store additional data.  The member
-     data.lisp_val is marked during GC, so it's safe to store Lisp data
-     there.  Image types should free this data when their `free'
-     function is called.  */
-  struct
-  {
-    int int_val;
-    void *ptr_val;
-    Lisp_Object lisp_val;
-  } data;
+  /* A place for image types to store additional data.  It is marked
+     during GC.  */
+  Lisp_Object lisp_data;
 
   /* Hash value of image specification to speed up comparisons.  */
   EMACS_UINT hash;

=== modified file 'src/image.c'
--- a/src/image.c       2011-06-10 20:34:05 +0000
+++ b/src/image.c       2011-06-11 01:48:59 +0000
@@ -971,7 +971,7 @@
       struct frame *f = check_x_frame (frame);
       int id = lookup_image (f, spec);
       struct image *img = IMAGE_FROM_ID (f, id);
-      ext = img->data.lisp_val;
+      ext = img->lisp_data;
     }
 
   return ext;
@@ -1001,7 +1001,7 @@
   img->type = lookup_image_type (image_spec_value (spec, QCtype, NULL));
   xassert (img->type != NULL);
   img->spec = spec;
-  img->data.lisp_val = Qnil;
+  img->lisp_data = Qnil;
   img->ascent = DEFAULT_IMAGE_ASCENT;
   img->hash = hash;
   img->corners[BOT_CORNER] = -1;  /* Full image */
@@ -1864,8 +1864,8 @@
   mark_object (img->spec);
   mark_object (img->dependencies);
 
-  if (!NILP (img->data.lisp_val))
-    mark_object (img->data.lisp_val);
+  if (!NILP (img->lisp_data))
+    mark_object (img->lisp_data);
 }
 
 
@@ -6818,9 +6818,9 @@
     continue;
 
   if (count > 1)
-    img->data.lisp_val = Fcons (Qcount,
-                               Fcons (make_number (count),
-                                      img->data.lisp_val));
+    img->lisp_data = Fcons (Qcount,
+                           Fcons (make_number (count),
+                                  img->lisp_data));
 
   fn_TIFFClose (tiff);
   if (!rc)
@@ -6959,8 +6959,7 @@
 static void
 gif_clear_image (struct frame *f, struct image *img)
 {
-  /* IMG->data.ptr_val may contain metadata with extension data.  */
-  img->data.lisp_val = Qnil;
+  img->lisp_data = Qnil;
   x_clear_image (f, img);
 }
 
@@ -7313,23 +7312,23 @@
 
   /* Save GIF image extension data for `image-metadata'.
      Format is (count IMAGES extension-data (FUNCTION "BYTES" ...)).  */
-  img->data.lisp_val = Qnil;
+  img->lisp_data = Qnil;
   if (gif->SavedImages[idx].ExtensionBlockCount > 0)
     {
       ExtensionBlock *ext = gif->SavedImages[idx].ExtensionBlocks;
       for (i = 0; i < gif->SavedImages[idx].ExtensionBlockCount; i++, ext++)
        /* Append (... FUNCTION "BYTES") */
-       img->data.lisp_val = Fcons (make_unibyte_string (ext->Bytes, 
ext->ByteCount),
-                                   Fcons (make_number (ext->Function),
-                                          img->data.lisp_val));
-      img->data.lisp_val = Fcons (Qextension_data,
-                                 Fcons (Fnreverse (img->data.lisp_val),
-                                        Qnil));
+       img->lisp_data = Fcons (make_unibyte_string (ext->Bytes, 
ext->ByteCount),
+                               Fcons (make_number (ext->Function),
+                                      img->lisp_data));
+      img->lisp_data = Fcons (Qextension_data,
+                             Fcons (Fnreverse (img->lisp_data),
+                                    Qnil));
     }
   if (gif->ImageCount > 1)
-    img->data.lisp_val = Fcons (Qcount,
-                               Fcons (make_number (gif->ImageCount),
-                                      img->data.lisp_val));
+    img->lisp_data = Fcons (Qcount,
+                           Fcons (make_number (gif->ImageCount),
+                                  img->lisp_data));
 
   fn_DGifCloseFile (gif);
 
@@ -7537,10 +7536,10 @@
     }
 
   if (MagickGetNumberImages(ping_wand) > 1)
-    img->data.lisp_val =
+    img->lisp_data =
       Fcons (Qcount,
              Fcons (make_number (MagickGetNumberImages (ping_wand)),
-                    img->data.lisp_val));
+                    img->lisp_data));
 
   DestroyMagickWand (ping_wand);
 
@@ -8340,8 +8339,6 @@
 static void
 gs_clear_image (struct frame *f, struct image *img)
 {
-  /* IMG->data.ptr_val may contain a recorded colormap.  */
-  xfree (img->data.ptr_val);
   x_clear_image (f, img);
 }
 
@@ -8450,12 +8447,12 @@
   if (NILP (loader))
     loader = intern ("gs-load-image");
 
-  img->data.lisp_val = call6 (loader, frame, img->spec,
-                             make_number (img->width),
-                             make_number (img->height),
-                             window_and_pixmap_id,
-                             pixel_colors);
-  return PROCESSP (img->data.lisp_val);
+  img->lisp_data = call6 (loader, frame, img->spec,
+                         make_number (img->width),
+                         make_number (img->height),
+                         window_and_pixmap_id,
+                         pixel_colors);
+  return PROCESSP (img->lisp_data);
 }
 
 
@@ -8483,9 +8480,9 @@
   /* Kill the GS process.  We should have found PIXMAP in the image
      cache and its image should contain a process object.  */
   img = c->images[i];
-  xassert (PROCESSP (img->data.lisp_val));
-  Fkill_process (img->data.lisp_val, Qnil);
-  img->data.lisp_val = Qnil;
+  xassert (PROCESSP (img->lisp_data));
+  Fkill_process (img->lisp_data, Qnil);
+  img->lisp_data = Qnil;
 
 #if defined (HAVE_X_WINDOWS)
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]