summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2023-12-22 15:24:00 +0100
committerJulien Nabet <serval2412@yahoo.fr>2023-12-22 18:13:54 +0100
commit20fdec77eb6862fd78c9b090e42cddf6b40dc9be (patch)
tree48b647ec1ec5255cd37b047e89f62a1f49788faa
parent761449adb54e965c94d31c36e945112736b232c5 (diff)
Use emplace_back instead of push_back (connectivity)
Change-Id: Ie90901832dafbaab56d3ac22bdb1cf91e3564fd4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161181 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
-rw-r--r--connectivity/source/drivers/firebird/Connection.cxx8
-rw-r--r--connectivity/source/drivers/firebird/Driver.cxx2
-rw-r--r--connectivity/source/drivers/flat/EDriver.cxx2
-rw-r--r--connectivity/source/drivers/jdbc/JConnection.cxx8
-rw-r--r--connectivity/source/drivers/mysql_jdbc/YDriver.cxx47
-rw-r--r--connectivity/source/drivers/postgresql/pq_tools.cxx30
-rw-r--r--connectivity/source/drivers/postgresql/pq_xcolumns.cxx2
-rw-r--r--connectivity/source/drivers/postgresql/pq_xcontainer.cxx2
-rw-r--r--connectivity/source/drivers/postgresql/pq_xindexes.cxx2
-rw-r--r--connectivity/source/drivers/postgresql/pq_xkeycolumns.cxx2
-rw-r--r--connectivity/source/drivers/writer/WConnection.cxx4
-rw-r--r--connectivity/source/drivers/writer/WDriver.cxx2
-rw-r--r--connectivity/source/parse/sqliterator.cxx2
13 files changed, 53 insertions, 60 deletions
diff --git a/connectivity/source/drivers/firebird/Connection.cxx b/connectivity/source/drivers/firebird/Connection.cxx
index d0008272e17f..9b1c83874f5d 100644
--- a/connectivity/source/drivers/firebird/Connection.cxx
+++ b/connectivity/source/drivers/firebird/Connection.cxx
@@ -358,7 +358,7 @@ Reference< XBlob> Connection::createBlob(ISC_QUAD const * pBlobId)
&m_aTransactionHandle,
*pBlobId);
- m_aStatements.push_back(WeakReferenceHelper(xReturn));
+ m_aStatements.emplace_back(xReturn);
return xReturn;
}
@@ -371,7 +371,7 @@ Reference< XClob> Connection::createClob(ISC_QUAD const * pBlobId)
&m_aTransactionHandle,
*pBlobId);
- m_aStatements.push_back(WeakReferenceHelper(xReturn));
+ m_aStatements.emplace_back(xReturn);
return xReturn;
}
@@ -402,7 +402,7 @@ Reference< XStatement > SAL_CALL Connection::createStatement( )
// create a statement
// the statement can only be executed once
Reference< XStatement > xReturn = new OStatement(this);
- m_aStatements.push_back(WeakReferenceHelper(xReturn));
+ m_aStatements.emplace_back(xReturn);
return xReturn;
}
@@ -418,7 +418,7 @@ Reference< XPreparedStatement > SAL_CALL Connection::prepareStatement(
buildTypeInfo();
Reference< XPreparedStatement > xReturn = new OPreparedStatement(this, _sSql);
- m_aStatements.push_back(WeakReferenceHelper(xReturn));
+ m_aStatements.emplace_back(xReturn);
return xReturn;
}
diff --git a/connectivity/source/drivers/firebird/Driver.cxx b/connectivity/source/drivers/firebird/Driver.cxx
index b674d56c22e7..3aa903d48abf 100644
--- a/connectivity/source/drivers/firebird/Driver.cxx
+++ b/connectivity/source/drivers/firebird/Driver.cxx
@@ -151,7 +151,7 @@ Reference< XConnection > SAL_CALL FirebirdDriver::connect(
rtl::Reference<Connection> pCon = new Connection();
pCon->construct(url, info);
- m_xConnections.push_back(WeakReferenceHelper(*pCon));
+ m_xConnections.emplace_back(*pCon);
return pCon;
}
diff --git a/connectivity/source/drivers/flat/EDriver.cxx b/connectivity/source/drivers/flat/EDriver.cxx
index 51e357611558..034e1b0b97f4 100644
--- a/connectivity/source/drivers/flat/EDriver.cxx
+++ b/connectivity/source/drivers/flat/EDriver.cxx
@@ -68,7 +68,7 @@ Reference< XConnection > SAL_CALL ODriver::connect( const OUString& url, const S
rtl::Reference<OFlatConnection> pCon = new OFlatConnection(this);
pCon->construct(url,info);
- m_xConnections.push_back(WeakReferenceHelper(*pCon));
+ m_xConnections.emplace_back(*pCon);
return pCon;
}
diff --git a/connectivity/source/drivers/jdbc/JConnection.cxx b/connectivity/source/drivers/jdbc/JConnection.cxx
index 77d0ff38799b..5844df568ba3 100644
--- a/connectivity/source/drivers/jdbc/JConnection.cxx
+++ b/connectivity/source/drivers/jdbc/JConnection.cxx
@@ -166,7 +166,7 @@ bool loadClass(
// JVM that are not easily undone). If the pushed ClassMapEntry is
// not used after all (return false, etc.) it will be pruned on next
// call because its classLoader/classObject are null:
- classMapData.map.push_back( ClassMapEntry( classPath, name ) );
+ classMapData.map.emplace_back(classPath, name);
i = std::prev(classMapData.map.end());
}
@@ -437,7 +437,7 @@ Reference< XStatement > SAL_CALL java_sql_Connection::createStatement( )
SDBThreadAttach t;
rtl::Reference<java_sql_Statement> pStatement = new java_sql_Statement( t.pEnv, *this );
Reference< XStatement > xStmt = pStatement;
- m_aStatements.push_back( WeakReferenceHelper( xStmt ) );
+ m_aStatements.emplace_back(xStmt);
m_aLogger.log( LogLevel::FINE, STR_LOG_CREATED_STATEMENT_ID, pStatement->getStatementObjectID() );
return xStmt;
@@ -453,7 +453,7 @@ Reference< XPreparedStatement > SAL_CALL java_sql_Connection::prepareStatement(
rtl::Reference<java_sql_PreparedStatement> pStatement = new java_sql_PreparedStatement( t.pEnv, *this, sql );
Reference< XPreparedStatement > xReturn( pStatement );
- m_aStatements.push_back(WeakReferenceHelper(xReturn));
+ m_aStatements.emplace_back(xReturn);
m_aLogger.log( LogLevel::FINE, STR_LOG_PREPARED_STATEMENT_ID, pStatement->getStatementObjectID() );
return xReturn;
@@ -469,7 +469,7 @@ Reference< XPreparedStatement > SAL_CALL java_sql_Connection::prepareCall( const
rtl::Reference<java_sql_CallableStatement> pStatement = new java_sql_CallableStatement( t.pEnv, *this, sql );
Reference< XPreparedStatement > xStmt( pStatement );
- m_aStatements.push_back(WeakReferenceHelper(xStmt));
+ m_aStatements.emplace_back(xStmt);
m_aLogger.log( LogLevel::FINE, STR_LOG_PREPARED_CALL_ID, pStatement->getStatementObjectID() );
return xStmt;
diff --git a/connectivity/source/drivers/mysql_jdbc/YDriver.cxx b/connectivity/source/drivers/mysql_jdbc/YDriver.cxx
index d62ee1b469b9..e4e338ee0b31 100644
--- a/connectivity/source/drivers/mysql_jdbc/YDriver.cxx
+++ b/connectivity/source/drivers/mysql_jdbc/YDriver.cxx
@@ -158,31 +158,25 @@ Sequence<PropertyValue> lcl_convertProperties(T_DRIVERTYPE _eType,
if (_eType == T_DRIVERTYPE::Odbc)
{
- aProps.push_back(PropertyValue("Silent", 0, Any(true), PropertyState_DIRECT_VALUE));
- aProps.push_back(
- PropertyValue("PreventGetVersionColumns", 0, Any(true), PropertyState_DIRECT_VALUE));
+ aProps.emplace_back("Silent", 0, Any(true), PropertyState_DIRECT_VALUE);
+ aProps.emplace_back("PreventGetVersionColumns", 0, Any(true), PropertyState_DIRECT_VALUE);
}
else if (_eType == T_DRIVERTYPE::Jdbc)
{
if (!jdc)
{
- aProps.push_back(PropertyValue("JavaDriverClass", 0,
- Any(OUString("com.mysql.jdbc.Driver")),
- PropertyState_DIRECT_VALUE));
+ aProps.emplace_back("JavaDriverClass", 0, Any(OUString("com.mysql.jdbc.Driver")),
+ PropertyState_DIRECT_VALUE);
}
}
else
{
- aProps.push_back(
- PropertyValue("PublicConnectionURL", 0, Any(_sUrl), PropertyState_DIRECT_VALUE));
+ aProps.emplace_back("PublicConnectionURL", 0, Any(_sUrl), PropertyState_DIRECT_VALUE);
}
- aProps.push_back(
- PropertyValue("IsAutoRetrievingEnabled", 0, Any(true), PropertyState_DIRECT_VALUE));
- aProps.push_back(PropertyValue("AutoRetrievingStatement", 0,
- Any(OUString("SELECT LAST_INSERT_ID()")),
- PropertyState_DIRECT_VALUE));
- aProps.push_back(
- PropertyValue("ParameterNameSubstitution", 0, Any(true), PropertyState_DIRECT_VALUE));
+ aProps.emplace_back("IsAutoRetrievingEnabled", 0, Any(true), PropertyState_DIRECT_VALUE);
+ aProps.emplace_back("AutoRetrievingStatement", 0, Any(OUString("SELECT LAST_INSERT_ID()")),
+ PropertyState_DIRECT_VALUE);
+ aProps.emplace_back("ParameterNameSubstitution", 0, Any(true), PropertyState_DIRECT_VALUE);
return Sequence<PropertyValue>(aProps.data(), aProps.size());
}
}
@@ -266,9 +260,9 @@ Reference<XConnection> SAL_CALL ODriverDelegator::connect(const OUString& url,
auto pMetaConnection = comphelper::getFromUnoTunnel<OMetaConnection>(xConnection);
if (pMetaConnection)
pMetaConnection->setURL(url);
- m_aConnections.push_back(
- TWeakPair(WeakReferenceHelper(xConnection),
- TWeakConnectionPair(WeakReferenceHelper(), pMetaConnection)));
+ m_aConnections.emplace_back(
+ WeakReferenceHelper(xConnection),
+ TWeakConnectionPair(WeakReferenceHelper(), pMetaConnection));
}
}
}
@@ -300,18 +294,17 @@ ODriverDelegator::getPropertyInfo(const OUString& url, const Sequence<PropertyVa
const T_DRIVERTYPE eType = lcl_getDriverType(url);
if (eType == T_DRIVERTYPE::Jdbc)
{
- aDriverInfo.push_back(DriverPropertyInfo("JavaDriverClass", "The JDBC driver class name.",
- true, getJavaDriverClass(info),
- Sequence<OUString>()));
+ aDriverInfo.emplace_back("JavaDriverClass", "The JDBC driver class name.", true,
+ getJavaDriverClass(info), Sequence<OUString>());
}
else if (eType == T_DRIVERTYPE::Native)
{
- aDriverInfo.push_back(DriverPropertyInfo(
- "LocalSocket", "The file path of a socket to connect to a local MySQL server.", false,
- OUString(), Sequence<OUString>()));
- aDriverInfo.push_back(DriverPropertyInfo(
- "NamedPipe", "The name of a pipe to connect to a local MySQL server.", false,
- OUString(), Sequence<OUString>()));
+ aDriverInfo.emplace_back("LocalSocket",
+ "The file path of a socket to connect to a local MySQL server.",
+ false, OUString(), Sequence<OUString>());
+ aDriverInfo.emplace_back("NamedPipe",
+ "The name of a pipe to connect to a local MySQL server.", false,
+ OUString(), Sequence<OUString>());
}
return Sequence<DriverPropertyInfo>(aDriverInfo.data(), aDriverInfo.size());
diff --git a/connectivity/source/drivers/postgresql/pq_tools.cxx b/connectivity/source/drivers/postgresql/pq_tools.cxx
index c7b94fee121f..29e3584aacb6 100644
--- a/connectivity/source/drivers/postgresql/pq_tools.cxx
+++ b/connectivity/source/drivers/postgresql/pq_tools.cxx
@@ -416,7 +416,7 @@ void splitSQL( const OString & sql, std::vector< OString > &vec )
{
if( '"' == c )
{
- vec.push_back( OString( &sql.getStr()[start], i-start+1 ) );
+ vec.emplace_back( &sql.getStr()[start], i-start+1 );
start = i + 1;
doubleQuote = false;
}
@@ -431,7 +431,7 @@ void splitSQL( const OString & sql, std::vector< OString > &vec )
}
else if( '\'' == c )
{
- vec.push_back( OString( &sql.getStr()[start], i - start +1 ) );
+ vec.emplace_back( &sql.getStr()[start], i - start +1 );
start = i + 1; // leave single quotes !
singleQuote = false;
}
@@ -440,20 +440,20 @@ void splitSQL( const OString & sql, std::vector< OString > &vec )
{
if( '"' == c )
{
- vec.push_back( OString( &sql.getStr()[start], i - start ) );
+ vec.emplace_back( &sql.getStr()[start], i - start );
doubleQuote = true;
start = i;
}
else if( '\'' == c )
{
- vec.push_back( OString( &sql.getStr()[start], i - start ) );
+ vec.emplace_back( &sql.getStr()[start], i - start );
singleQuote = true;
start = i;
}
}
}
if( start < i )
- vec.push_back( OString( &sql.getStr()[start] , i - start ) );
+ vec.emplace_back( &sql.getStr()[start] , i - start );
// for( i = 0 ; i < vec.size() ; i ++ )
// printf( "%s!" , vec[i].getStr() );
@@ -476,7 +476,7 @@ void tokenizeSQL( const OString & sql, std::vector< OString > &vec )
{
if( '"' == c )
{
- vec.push_back( OString( &sql.getStr()[start], i-start ) );
+ vec.emplace_back( &sql.getStr()[start], i-start );
start = i + 1;
doubleQuote = false;
}
@@ -485,7 +485,7 @@ void tokenizeSQL( const OString & sql, std::vector< OString > &vec )
{
if( '\'' == c )
{
- vec.push_back( OString( &sql.getStr()[start], i - start +1 ) );
+ vec.emplace_back( &sql.getStr()[start], i - start +1 );
start = i + 1; // leave single quotes !
singleQuote = false;
}
@@ -508,15 +508,15 @@ void tokenizeSQL( const OString & sql, std::vector< OString > &vec )
start ++; // skip additional whitespace
else
{
- vec.push_back( OString( &sql.getStr()[start], i - start ) );
+ vec.emplace_back( &sql.getStr()[start], i - start );
start = i +1;
}
}
else if( ',' == c || isOperator( c ) || '(' == c || ')' == c )
{
if( i - start )
- vec.push_back( OString( &sql.getStr()[start], i - start ) );
- vec.push_back( OString( &sql.getStr()[i], 1 ) );
+ vec.emplace_back( &sql.getStr()[start], i - start );
+ vec.emplace_back( &sql.getStr()[i], 1 );
start = i + 1;
}
else if( '.' == c )
@@ -529,15 +529,15 @@ void tokenizeSQL( const OString & sql, std::vector< OString > &vec )
else
{
if( i - start )
- vec.push_back( OString( &sql.getStr()[start], i - start ) );
- vec.push_back( "."_ostr );
+ vec.emplace_back( &sql.getStr()[start], i - start );
+ vec.emplace_back( "." );
start = i + 1;
}
}
}
}
if( start < i )
- vec.push_back( OString( &sql.getStr()[start] , i - start ) );
+ vec.emplace_back( &sql.getStr()[start] , i - start );
// for( i = 0 ; i < vec.size() ; i ++ )
// printf( "%s!" , vec[i].getStr() );
@@ -644,7 +644,7 @@ std::vector< Any > parseArray( std::u16string_view str )
if( brackets == 0 )
{
if( !current.isEmpty() || doubleQuotedValue )
- elements.push_back( Any( current.makeStringAndClear() ) );
+ elements.emplace_back( current.makeStringAndClear() );
}
else
{
@@ -673,7 +673,7 @@ std::vector< Any > parseArray( std::u16string_view str )
else if( ',' == c && brackets == 1)
{
doubleQuotedValue = false;
- elements.push_back( Any( current.makeStringAndClear() ) );
+ elements.emplace_back( current.makeStringAndClear() );
}
else if( isWhitespace( c ) )
{
diff --git a/connectivity/source/drivers/postgresql/pq_xcolumns.cxx b/connectivity/source/drivers/postgresql/pq_xcolumns.cxx
index b72d569d2256..2902879c49b0 100644
--- a/connectivity/source/drivers/postgresql/pq_xcolumns.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xcolumns.cxx
@@ -317,7 +317,7 @@ void Columns::refresh()
// name ) );
{
- m_values.push_back( Any( prop ) );
+ m_values.emplace_back(prop);
map[ name ] = columnIndex;
++columnIndex;
}
diff --git a/connectivity/source/drivers/postgresql/pq_xcontainer.cxx b/connectivity/source/drivers/postgresql/pq_xcontainer.cxx
index 9d594280065d..131148c3e192 100644
--- a/connectivity/source/drivers/postgresql/pq_xcontainer.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xcontainer.cxx
@@ -352,7 +352,7 @@ void Container::append(
}
int index = m_values.size();
- m_values.push_back( Any( descriptor ) );
+ m_values.emplace_back(descriptor);
m_name2index[name] = index;
fire( InsertedBroadcaster( *this, name, Any( descriptor ) ) );
diff --git a/connectivity/source/drivers/postgresql/pq_xindexes.cxx b/connectivity/source/drivers/postgresql/pq_xindexes.cxx
index 79f0939c1aba..bff96216c568 100644
--- a/connectivity/source/drivers/postgresql/pq_xindexes.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xindexes.cxx
@@ -164,7 +164,7 @@ void Indexes::refresh()
st.PRIVATE_COLUMN_INDEXES, Any( columnNames ));
{
- m_values.push_back( Any( prop ) );
+ m_values.emplace_back(prop);
map[ currentIndexName ] = index;
++index;
}
diff --git a/connectivity/source/drivers/postgresql/pq_xkeycolumns.cxx b/connectivity/source/drivers/postgresql/pq_xkeycolumns.cxx
index 97e0ef29bbda..89f63ceb5a65 100644
--- a/connectivity/source/drivers/postgresql/pq_xkeycolumns.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xkeycolumns.cxx
@@ -130,7 +130,7 @@ void KeyColumns::refresh()
}
{
- m_values.push_back( Any( prop ) );
+ m_values.emplace_back(prop);
map[ name ] = columnIndex;
++columnIndex;
}
diff --git a/connectivity/source/drivers/writer/WConnection.cxx b/connectivity/source/drivers/writer/WConnection.cxx
index 39724538cb3e..962af9dbacaf 100644
--- a/connectivity/source/drivers/writer/WConnection.cxx
+++ b/connectivity/source/drivers/writer/WConnection.cxx
@@ -213,7 +213,7 @@ uno::Reference<sdbc::XStatement> SAL_CALL OWriterConnection::createStatement()
checkDisposed(OConnection_BASE::rBHelper.bDisposed);
uno::Reference<sdbc::XStatement> xReturn = new component::OComponentStatement(this);
- m_aStatements.push_back(uno::WeakReferenceHelper(xReturn));
+ m_aStatements.emplace_back(xReturn);
return xReturn;
}
@@ -226,7 +226,7 @@ uno::Reference<sdbc::XPreparedStatement>
rtl::Reference<component::OComponentPreparedStatement> pStmt
= new component::OComponentPreparedStatement(this);
pStmt->construct(sql);
- m_aStatements.push_back(uno::WeakReferenceHelper(*pStmt));
+ m_aStatements.emplace_back(*pStmt);
return pStmt;
}
diff --git a/connectivity/source/drivers/writer/WDriver.cxx b/connectivity/source/drivers/writer/WDriver.cxx
index 21325d73f6b6..bbd0f71838c1 100644
--- a/connectivity/source/drivers/writer/WDriver.cxx
+++ b/connectivity/source/drivers/writer/WDriver.cxx
@@ -60,7 +60,7 @@ uno::Reference<sdbc::XConnection>
rtl::Reference<OWriterConnection> pCon = new OWriterConnection(this);
pCon->construct(url, info);
- m_xConnections.push_back(uno::WeakReferenceHelper(*pCon));
+ m_xConnections.emplace_back(*pCon);
return pCon;
}
diff --git a/connectivity/source/parse/sqliterator.cxx b/connectivity/source/parse/sqliterator.cxx
index a89d631e256b..8ca4d6271fc4 100644
--- a/connectivity/source/parse/sqliterator.cxx
+++ b/connectivity/source/parse/sqliterator.cxx
@@ -525,7 +525,7 @@ void OSQLParseTreeIterator::getQualified_join( OSQLTables& _rTables, const OSQLP
{
const OSQLParseNode * pCol = pColumnCommalist->getChild(i);
// add twice because the column must exists in both tables
- m_pImpl->m_aJoinConditions.push_back( TNodePair(pCol,pCol) );
+ m_pImpl->m_aJoinConditions.emplace_back(pCol,pCol);
}
}
}