[Libreoffice-commits] core.git: canvas/source

Julien Nabet serval2412 at yahoo.fr
Thu Jan 7 22:06:49 PST 2016


 canvas/source/opengl/ogl_texturecache.cxx |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

New commits:
commit 4af3fd71eb0b698089acaac064cec4b318362cfd
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Thu Jan 7 23:33:24 2016 +0100

    Remove useless extra var for loop
    
    Take benefit of returned iterator from erase method
    
    Change-Id: I77eaa5b4500cfc66ae66e5f388915e0ade79b23c
    Reviewed-on: https://gerrit.libreoffice.org/21239
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>

diff --git a/canvas/source/opengl/ogl_texturecache.cxx b/canvas/source/opengl/ogl_texturecache.cxx
index 9335ff9..08cdd2f 100644
--- a/canvas/source/opengl/ogl_texturecache.cxx
+++ b/canvas/source/opengl/ogl_texturecache.cxx
@@ -54,20 +54,18 @@ namespace oglcanvas
 
         // delete already "old" textures, mark "new" entries "old"
         const TextureCacheMapT::const_iterator aEnd = maCache.end();
-        TextureCacheMapT::iterator aNext = maCache.begin();
-        ++aNext;
-        for( auto aCurr = maCache.begin(); aCurr != aEnd; ++aNext )
+        for( auto aCurr = maCache.begin(); aCurr != aEnd; /* increment managed in loop */)
         {
             if( aCurr->second.bOld )
             {
                 glDeleteTextures( 1, &aCurr->second.nTexture );
-                maCache.erase( aCurr );
+                aCurr = maCache.erase( aCurr );
             }
             else
             {
                 aCurr->second.bOld = true;
+                ++aCurr;
             }
-            aCurr = aNext;
         }
 
         mnMissCount = 0;


More information about the Libreoffice-commits mailing list