diff --git a/ChangeLog b/ChangeLog index 8e8349aa487..ac96bed2983 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-08-15 Ken Brown + + * configure.ac (G_SLICE_ALWAYS_MALLOC): Update comment. + 2013-08-15 Glenn Morris * make-dist: Do not distribute etc/refcards TeX intermediate files. diff --git a/configure.ac b/configure.ac index 9c6a5bdfadf..f97ce719a36 100644 --- a/configure.ac +++ b/configure.ac @@ -4379,14 +4379,16 @@ fi case $opsys in - dnl Emacs supplies its own malloc, but glib (part of Gtk+) calls - dnl memalign and on Cygwin, that becomes the Cygwin-supplied memalign. - dnl As malloc is not the Cygwin malloc, the Cygwin memalign always - dnl returns ENOSYS. A workaround is to set G_SLICE=always-malloc. */ + dnl Emacs supplies its own malloc, but glib calls posix_memalign, + dnl and on Cygwin prior to version 1.7.24 that becomes the + dnl Cygwin-supplied posix_memalign. As malloc is not the Cygwin + dnl malloc, the Cygwin posix_memalign always returns ENOSYS. A + dnl workaround is to set G_SLICE=always-malloc. This is no longer + dnl needed starting with cygwin-1.7.24, and it is no longer + dnl effective starting with glib-2.36. */ cygwin) AC_DEFINE(G_SLICE_ALWAYS_MALLOC, 1, [Define to set the - G_SLICE environment variable to "always-malloc" at startup, if - using GTK.]) + G_SLICE environment variable to "always-malloc" at startup.]) ;; hpux11) diff --git a/src/ChangeLog b/src/ChangeLog index 888db1f8cf4..c12b32ebc71 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,20 @@ +2013-08-15 Ken Brown + + * emacs.c (main): Update comment about G_SLICE_ALWAYS_MALLOC. + * gmalloc.c (memalign) [CYGWIN]: Revert last change; it's not + needed. + +2013-08-15 Paul Eggert + + Fix minor problems found by static checking. + * frame.c (delete_frame): + * xdisp.c (next_element_from_display_vector): + Avoid uninitialized local. + * image.c (imagemagick_compute_animated_image): Port to C89. + Prefer usual GNU indentation style for loops. + Be more careful about bizarrely large sizes, by using ptrdiff_t + instead of int. + 2013-08-15 Dmitry Antipov Fix infinite frame selection loop (Bug#15025). @@ -18,6 +35,9 @@ * image.c (imagemagick_compute_animated_image): Implement animated images (bug#14700). + (imagemagick_compute_animated_image): Fix some compilation + warnings. Implement a very simple cache to make the animation + usable at all, but it should be replaced with a per-image cache. 2013-08-15 Dmitry Antipov diff --git a/src/emacs.c b/src/emacs.c index 9b8283cd64c..96a5d33f363 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -699,7 +699,8 @@ main (int argc, char **argv) #endif #ifdef G_SLICE_ALWAYS_MALLOC - /* This is used by the Cygwin build. */ + /* This is used by the Cygwin build. It's not needed starting with + cygwin-1.7.24, but it doesn't do any harm. */ xputenv ("G_SLICE=always-malloc"); #endif diff --git a/src/frame.c b/src/frame.c index 957f08b06c5..5ee001f4d98 100644 --- a/src/frame.c +++ b/src/frame.c @@ -1197,7 +1197,8 @@ delete_frame (Lisp_Object frame, Lisp_Object force) /* Don't let the frame remain selected. */ if (f == sf) { - Lisp_Object tail, frame1; + Lisp_Object tail; + Lisp_Object frame1 = Qnil; /* Look for another visible frame on the same terminal. Do not call next_frame here because it may loop forever. diff --git a/src/gmalloc.c b/src/gmalloc.c index 42ac0b03985..bc1d85ac5fb 100644 --- a/src/gmalloc.c +++ b/src/gmalloc.c @@ -1558,15 +1558,6 @@ License along with this library. If not, see . * void *(*__memalign_hook) (size_t size, size_t alignment); -/* As of version 1.7.24, Cygwin allows applications to provide their - own posix_memalign (but not memalign). But posix_memalign as - defined in this file calls memalign, so we have to rename the - latter in order to make sure that posix_memalign calls Emacs's - memalign. */ -#ifdef CYGWIN -#define memalign emacs_memalign -#endif - void * memalign (size_t alignment, size_t size) { diff --git a/src/image.c b/src/image.c index c534f181e5c..3cab72edf74 100644 --- a/src/image.c +++ b/src/image.c @@ -7871,63 +7871,80 @@ imagemagick_filename_hint (Lisp_Object spec, char hint_buffer[MaxTextExtent]) compute ann the preceding images to be able to display a particular sub-image. */ +static MagickWand *animation_cache = NULL; +static int animation_index = 0; + static MagickWand * imagemagick_compute_animated_image (MagickWand *super_wand, int ino) { + int i; MagickWand *composite_wand; MagickSetIteratorIndex (super_wand, 0); - composite_wand = MagickGetImage (super_wand); - for (int i = 1; i <= ino; i++) { - MagickWand *sub_wand; - PixelIterator *source_iterator, *dest_iterator; - PixelWand **source, **dest; - long source_width, dest_width; - MagickPixelPacket pixel; + if (ino == 0 || animation_cache == NULL) + composite_wand = MagickGetImage (super_wand); + else + composite_wand = animation_cache; - MagickSetIteratorIndex (super_wand, i); - sub_wand = MagickGetImage (super_wand); + for (i = max (1, animation_index); i <= ino; i++) + { + MagickWand *sub_wand; + PixelIterator *source_iterator, *dest_iterator; + PixelWand **source, **dest; + size_t source_width, dest_width; + MagickPixelPacket pixel; - source_iterator = NewPixelIterator (sub_wand); - if (! source_iterator) - { - DestroyMagickWand (composite_wand); - DestroyMagickWand (sub_wand); - image_error ("Imagemagick pixel iterator creation failed", - Qnil, Qnil); - return NULL; - } + MagickSetIteratorIndex (super_wand, i); + sub_wand = MagickGetImage (super_wand); - dest_iterator = NewPixelIterator (composite_wand); - if (! dest_iterator) - { - DestroyMagickWand (composite_wand); - DestroyMagickWand (sub_wand); - DestroyPixelIterator (source_iterator); - image_error ("Imagemagick pixel iterator creation failed", - Qnil, Qnil); - return NULL; - } - - while (source = PixelGetNextIteratorRow (source_iterator, &source_width)) { - dest = PixelGetNextIteratorRow (dest_iterator, &dest_width); - for (int x = 0; x < source_width; x++) + source_iterator = NewPixelIterator (sub_wand); + if (! source_iterator) { - /* Copy over non-transparent pixels. */ - if (PixelGetAlpha (source[x])) - { - PixelGetMagickColor (source[x], &pixel); - PixelSetMagickColor (dest[x], &pixel); - } + DestroyMagickWand (composite_wand); + DestroyMagickWand (sub_wand); + image_error ("Imagemagick pixel iterator creation failed", + Qnil, Qnil); + return NULL; } - PixelSyncIterator(dest_iterator); + + dest_iterator = NewPixelIterator (composite_wand); + if (! dest_iterator) + { + DestroyMagickWand (composite_wand); + DestroyMagickWand (sub_wand); + DestroyPixelIterator (source_iterator); + image_error ("Imagemagick pixel iterator creation failed", + Qnil, Qnil); + return NULL; + } + + while ((source = PixelGetNextIteratorRow (source_iterator, &source_width)) + != NULL) + { + ptrdiff_t x; + dest = PixelGetNextIteratorRow (dest_iterator, &dest_width); + for (x = 0; x < source_width; x++) + { + /* Copy over non-transparent pixels. */ + if (PixelGetAlpha (source[x])) + { + PixelGetMagickColor (source[x], &pixel); + PixelSetMagickColor (dest[x], &pixel); + } + } + PixelSyncIterator(dest_iterator); + } + + DestroyPixelIterator (source_iterator); + DestroyPixelIterator (dest_iterator); + DestroyMagickWand (sub_wand); } - DestroyPixelIterator (source_iterator); - DestroyPixelIterator (dest_iterator); - DestroyMagickWand (sub_wand); - } + /* Cache a copy for the next iteration. The current wand will be + destroyed by the caller. */ + animation_cache = CloneMagickWand (composite_wand); + animation_index = ino; return composite_wand; } diff --git a/src/xdisp.c b/src/xdisp.c index bfa012ef70c..5faa2abd72a 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -7550,6 +7550,7 @@ next_element_from_display_vector (struct it *it) /* For the last character of the box-face run, we need to look either at the next glyph from the display vector, or at the face we saw before the display vector. */ + next_face_id = it->saved_face_id; if (it->current.dpvec_index < it->dpend - it->dpvec - 1) { if (it->dpvec_face_id >= 0) @@ -7564,8 +7565,6 @@ next_element_from_display_vector (struct it *it) it->saved_face_id); } } - else - next_face_id = it->saved_face_id; next_face = FACE_FROM_ID (it->f, next_face_id); it->end_of_box_run_p = (this_face && this_face->box != FACE_NO_BOX && (!next_face