]> granicus.if.org Git - imagemagick/commitdiff
...
authorCristy <urban-warrior@imagemagick.org>
Wed, 18 Apr 2018 00:26:04 +0000 (20:26 -0400)
committerCristy <urban-warrior@imagemagick.org>
Wed, 18 Apr 2018 00:26:04 +0000 (20:26 -0400)
MagickCore/list.c

index c6e62c3f07f122babfc99480cff5619aef7b912b..2646d6b7c3908f6832283fd6c344a1baa21ca997 100644 (file)
@@ -599,17 +599,10 @@ MagickExport Image *GetImageFromList(const Image *images,const ssize_t index)
   assert(images->signature == MagickCoreSignature);
   if (images->debug != MagickFalse)
     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",images->filename);
-
-  /*
-    Designed to efficiently find first image (index == 0), or last image
-    (index == -1) as appropriate, without to go through the whole image list.
-    That is it tries to avoid 'counting the whole list' to  handle the
-    most common image indexes.
-  */
-  if ( index < 0 )
+  if (index < 0)
     {
       p=GetLastImageInList(images);
-      for (i=-1; p != (Image *) NULL; p=p->previous)
+      for (i=(-1); p != (Image *) NULL; p=p->previous)
         if (i-- == index)
           break;
     }