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

Julien Nabet serval2412 at yahoo.fr
Sat Nov 25 23:48:36 UTC 2017


 codemaker/source/javamaker/classfile.cxx |    8 ++++----
 codemaker/source/javamaker/classfile.hxx |    5 ++---
 codemaker/source/javamaker/javatype.cxx  |    5 ++---
 3 files changed, 8 insertions(+), 10 deletions(-)

New commits:
commit 10593acac0bc42878fea34fe7da3f389f256c317
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Sat Nov 25 18:33:25 2017 +0100

    Replace most lists by vectors in codemaker
    
    Change-Id: Id867b497514d2d795504ae5c9e7d0ad356524ad5
    Reviewed-on: https://gerrit.libreoffice.org/45274
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>

diff --git a/codemaker/source/javamaker/classfile.cxx b/codemaker/source/javamaker/classfile.cxx
index 37858991edec..1df31aea6947 100644
--- a/codemaker/source/javamaker/classfile.cxx
+++ b/codemaker/source/javamaker/classfile.cxx
@@ -227,12 +227,12 @@ void ClassFile::Code::instrInvokevirtual(
 
 void ClassFile::Code::instrLookupswitch(
     Code const * defaultBlock,
-    std::list< std::pair< sal_Int32, Code * > > const & blocks)
+    std::vector< std::pair< sal_Int32, Code * > > const & blocks)
 {
     // lookupswitch <0--3 byte pad> <defaultbyte1> <defaultbyte2> <defaultbyte3>
     // <defaultbyte4> <npairs1> <npairs2> <npairs3> <npairs4>
     // <match--offset pairs...>:
-    std::list< std::pair< sal_Int32, Code * > >::size_type size = blocks.size();
+    std::vector< std::pair< sal_Int32, Code * > >::size_type size = blocks.size();
     if (size > SAL_MAX_INT32) {
         throw CannotDumpException("Lookup-switch too large for Java class file format");
     }
@@ -312,7 +312,7 @@ void ClassFile::Code::instrSwap() {
 
 void ClassFile::Code::instrTableswitch(
     Code const * defaultBlock, sal_Int32 low,
-    std::list< Code * > const & blocks)
+    std::vector< Code * > const & blocks)
 {
     // tableswitch <0--3 byte pad> <defaultbyte1> <defaultbyte2> <defaultbyte3>
     // <defaultbyte4> <lowbyte1> <lowbyte2> <lowbyte3> <lowbyte4> <highbyte1>
@@ -323,7 +323,7 @@ void ClassFile::Code::instrTableswitch(
     for (int i = 0; i < pad; ++i) {
         appendU1(m_code, 0);
     }
-    std::list< Code * >::size_type size = blocks.size();
+    std::vector< Code * >::size_type size = blocks.size();
     Position pos2 = pos1 + 1 + pad + 12 + size * 4; //FIXME: overflow
     sal_uInt32 defaultOffset = static_cast< sal_uInt32 >(pos2 - pos1);
         //FIXME: overflow
diff --git a/codemaker/source/javamaker/classfile.hxx b/codemaker/source/javamaker/classfile.hxx
index 6e5466d5b701..be6e3a36abe4 100644
--- a/codemaker/source/javamaker/classfile.hxx
+++ b/codemaker/source/javamaker/classfile.hxx
@@ -23,7 +23,6 @@
 #include <codemaker/unotype.hxx>
 #include <sal/types.h>
 
-#include <list>
 #include <map>
 #include <utility>
 #include <vector>
@@ -89,7 +88,7 @@ public:
 
         void instrLookupswitch(
             Code const * defaultBlock,
-            std::list< std::pair< sal_Int32, Code * > > const & blocks);
+            std::vector< std::pair< sal_Int32, Code * > > const & blocks);
 
         void instrNew(rtl::OString const & type);
         void instrNewarray(codemaker::UnoType::Sort sort);
@@ -108,7 +107,7 @@ public:
 
         void instrTableswitch(
             Code const * defaultBlock, sal_Int32 low,
-            std::list< Code * > const & blocks);
+            std::vector< Code * > const & blocks);
 
         void loadIntegerConstant(sal_Int32 value);
         void loadStringConstant(rtl::OString const & value);
diff --git a/codemaker/source/javamaker/javatype.cxx b/codemaker/source/javamaker/javatype.cxx
index dae125e7a3bb..71f4faa16117 100644
--- a/codemaker/source/javamaker/javatype.cxx
+++ b/codemaker/source/javamaker/javatype.cxx
@@ -22,7 +22,6 @@
 #include <algorithm>
 #include <cassert>
 #include <cstdlib>
-#include <list>
 #include <map>
 #include <memory>
 #include <set>
@@ -752,7 +751,7 @@ void handleEnumType(
         std::unique_ptr< ClassFile::Code > defCode(cf->newCode());
         defCode->instrAconstNull();
         defCode->instrAreturn();
-        std::list< ClassFile::Code * > blocks;
+        std::vector< ClassFile::Code * > blocks;
             //FIXME: pointers contained in blocks may leak
         sal_Int32 last = SAL_MAX_INT32;
         for (const auto& pair : map)
@@ -779,7 +778,7 @@ void handleEnumType(
         std::unique_ptr< ClassFile::Code > defCode(cf->newCode());
         defCode->instrAconstNull();
         defCode->instrAreturn();
-        std::list< std::pair< sal_Int32, ClassFile::Code * > > blocks;
+        std::vector< std::pair< sal_Int32, ClassFile::Code * > > blocks;
             //FIXME: pointers contained in blocks may leak
         for (const auto& pair : map )
         {


More information about the Libreoffice-commits mailing list