[PATCH] Rewrite as a static table of keywords and loop over them

Anthony Youngman (via Code Review) gerrit at gerrit.libreoffice.org
Fri Apr 26 01:20:52 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/3615

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/15/3615/1

Rewrite as a static table of keywords and loop over them

This patch implements a TODO so that new keywords can simply be added to
a static array rather than new "else if" blocks being added one per
keyword

Change-Id: I8aa4ff0f39166014c299783203eb646817b1399c
---
M connectivity/source/drivers/postgresql/pq_connection.cxx
1 file changed, 3 insertions(+), 2 deletions(-)



diff --git a/connectivity/source/drivers/postgresql/pq_connection.cxx b/connectivity/source/drivers/postgresql/pq_connection.cxx
index b17ad9f..f0d9e03 100644
--- a/connectivity/source/drivers/postgresql/pq_connection.cxx
+++ b/connectivity/source/drivers/postgresql/pq_connection.cxx
@@ -496,9 +496,10 @@
     for( int i = 0; i < args.getLength() ; ++i )
     {
         bool append = false;
-        for( int j = 0; j < (int) ( sizeof( keyword_list ) / sizeof( char * )); j++)
+//        for( int j = 0; j < (int) ( sizeof( keyword_list ) / sizeof( char * )); j++)
+        for( int j = 0; j < (int) SAL_N_ELEMENTS( keyword_list ); j++)
         {
-            if( args[i].Name.matchIgnoreAsciiCaseAsciiL( keyword_list[j] ))
+            if( args[i].Name.equalsIgnoreAsciiCaseAscii( keyword_list[j] ))
             {
                 keywords.push_back( keyword_list[j], SAL_NO_ACQUIRE );
                 append = true;

-- 
To view, visit https://gerrit.libreoffice.org/3615
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8aa4ff0f39166014c299783203eb646817b1399c
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Anthony Youngman <anthony at youngman.org.uk>



More information about the LibreOffice mailing list