Date: Thursday, January 25, 2007 @ 16:10:52
  Author: marc
    Path: /cvsroot/carob/carob/src

Modified: Connection.cpp (1.103 -> 1.104) ControllerInfo.cpp (1.14 ->
          1.15) ControllerPingSender.cpp (1.6 -> 1.7) ControllerPool.cpp
          (1.18 -> 1.19) ControllerStateChangedCallback.cpp (1.6 -> 1.7)
          ControllerWatcher.cpp (1.13 -> 1.14) DriverResultSet.cpp (1.60
          -> 1.61) JavaSocket.cpp (1.78 -> 1.79) Statement.cpp (1.32 ->
          1.33) WatchedControllers.cpp (1.5 -> 1.6)

Optimization: massive search & replace of fctName type, from
std::wstring to wchar_t so we don't instantiate a new wstring object
at each function entry but only when logging


------------------------------------+
 Connection.cpp                     |   46 +++++++++++++++++------------------
 ControllerInfo.cpp                 |    4 +--
 ControllerPingSender.cpp           |    2 -
 ControllerPool.cpp                 |    4 +--
 ControllerStateChangedCallback.cpp |    2 -
 ControllerWatcher.cpp              |    6 ++--
 DriverResultSet.cpp                |    2 -
 JavaSocket.cpp                     |   28 ++++++++++-----------
 Statement.cpp                      |    6 ++--
 WatchedControllers.cpp             |    4 +--
 10 files changed, 52 insertions(+), 52 deletions(-)


Index: carob/src/Connection.cpp
diff -u carob/src/Connection.cpp:1.103 carob/src/Connection.cpp:1.104
--- carob/src/Connection.cpp:1.103      Thu Jan 11 19:37:07 2007
+++ carob/src/Connection.cpp    Thu Jan 25 16:10:52 2007
@@ -97,7 +97,7 @@
   parameters(prms),
   auto_delete_statements(true)
 {
-  const wstring fctName(L"Connection::Connection");
+  const wchar_t fctName[] = L"Connection::Connection";
   persistent_connection = parameters.getPersistentConnection();
   retrieve_sql_warnings = parameters.getRetrieveSQLWarnings();
   try
@@ -166,7 +166,7 @@
     throw (AuthenticationException, NoMoreControllerException,
     VirtualDatabaseUnavailableException, UnexpectedException)
 {
-  const wstring fctName(L"Connection::initConnectionToNextController");
+  const wchar_t fctName[] = L"Connection::initConnectionToNextController";
   try
   {
     // This must lock the pool synchro to avoid controller list operations
@@ -223,7 +223,7 @@
 void Connection::finalizeConnect() throw (AuthenticationException,
     SocketIOException, VirtualDatabaseUnavailableException, 
UnexpectedException)
 {
-  const wstring fctName(L"Connection::finalizeConnect");
+  const wchar_t fctName[] = L"Connection::finalizeConnect";
   bool vdbFound = false,
        authenticated = false;
   *driverSocketPtr >> vdbFound;
@@ -250,7 +250,7 @@
     if (success)
       *driverSocketPtr >> persistent_connection_id;
     else
-      throw AuthenticationException(fctName + 
+      throw AuthenticationException(std::wstring(fctName) + 
           L" No more persistent connections available for given virtual 
database");
   }
   *driverSocketPtr << retrieve_sql_warnings;
@@ -278,7 +278,7 @@
 
 void Connection::corruptedConnectionClose(const CarobException& reason)
 {
-  const std::wstring fctName(L"Connection::corruptedConnectionClose(const 
CarobException&)");
+  const wchar_t fctName[] = L"Connection::corruptedConnectionClose(const 
CarobException&)";
 
   std::wostringstream buffer;
   buffer << reason;
@@ -301,7 +301,7 @@
 
 bool Connection::close()
 {
-  const wstring fctName(L"Connection::close");
+  const wchar_t fctName[] = L"Connection::close";
 
   //Wait until other methods/Commands are done
   LockScope ls(&connectionCS);
@@ -325,7 +325,7 @@
 
 bool Connection::closeSocket()
 {
-  const wstring fctName(L"Connection::closeSocket");
+  const wchar_t fctName[] = L"Connection::closeSocket";
   bool closeOK = false;
 
   if (driverSocketPtr == NULL)
@@ -357,7 +357,7 @@
     throw (SocketIOException, BackendException, ControllerException, 
     ProtocolException, ConnectionException, UnexpectedException)
 {
-  const wstring fctName(L"Connection::setAutoCommit");
+  const wchar_t fctName[] = L"Connection::setAutoCommit";
 
   LockScope ls(&connectionCS);
   
@@ -401,7 +401,7 @@
     BackendException, ControllerException, DriverException, ProtocolException,
     ConnectionException, UnexpectedException)
 {
-  const wstring fctName(L"Connection::beginTransactionIfNeeded");
+  const wchar_t fctName[] = L"Connection::beginTransactionIfNeeded";
   if (mustBeginTransaction)
   {
     FO_TRY_NTIMES(RECONNECT_RETRIES)
@@ -429,7 +429,7 @@
 void Connection::commit() throw (SocketIOException, DriverException,
     ProtocolException, ConnectionException, UnexpectedException)
 {
-  const wstring fctName(L"Connection::commit");
+  const wchar_t fctName[] = L"Connection::commit";
   
   LockScope ls(&connectionCS);
   checkIfConnected();
@@ -492,7 +492,7 @@
 void Connection::rollback() throw (SocketIOException, DriverException,
     ProtocolException, ConnectionException, UnexpectedException)
 {
-  const wstring fctName(L"Connection::rollback");
+  const wchar_t fctName[] = L"Connection::rollback";
   
   LockScope ls(&connectionCS);
 
@@ -575,7 +575,7 @@
     UnexpectedException)
 {
   checkIfConnected();
-  const wstring fctName(L"Connection::PreparedStatementGetMetaData");
+  const wchar_t fctName[] = L"Connection::PreparedStatementGetMetaData";
 
   LockScope ls(&connectionCS);
 
@@ -603,7 +603,7 @@
     ConnectionException, UnexpectedException)
 {
 
-  const wstring fctName(L"Connection::statementExecuteQuery");
+  const wchar_t fctName[] = L"Connection::statementExecuteQuery";
 
   LockScope ls(&connectionCS);
 
@@ -635,7 +635,7 @@
     throw (SocketIOException, BackendException, ControllerException,
     DriverException, ProtocolException, ConnectionException, 
UnexpectedException)
 {
-  const wstring fctName(L"Connection::statementExecuteUpdate");
+  const wchar_t fctName[] = L"Connection::statementExecuteUpdate";
 
   LockScope ls(&connectionCS);
 
@@ -691,7 +691,7 @@
     BackendException, ControllerException, DriverException, ProtocolException,
     ConnectionException, UnexpectedException)
 {
-  const wstring fctName(L"Connection::statementExecute");
+  const wchar_t fctName[] = L"Connection::statementExecute";
 
   LockScope ls(&connectionCS);
   checkIfConnected();
@@ -751,7 +751,7 @@
     ControllerException, DriverException, ProtocolException, 
ConnectionException,
     UnexpectedException)
 {
-  const wstring fctName(L"Connection::statementExecuteUpdateWithKeys");
+  const wchar_t fctName[] = L"Connection::statementExecuteUpdateWithKeys";
 
   LockScope ls(&connectionCS);
 
@@ -839,7 +839,7 @@
     throw (SocketIOException, ControllerException, ProtocolException,
     BackendException, UnexpectedException)
 {   
-  const wstring fctName(L"Connection::tryFetchNext");
+  const wchar_t fctName[] = L"Connection::tryFetchNext";
 
   LockScope ls(&connectionCS);
 
@@ -865,7 +865,7 @@
     throw (SocketIOException, BackendException, ControllerException,
     ProtocolException, UnexpectedException)
 {
-  const wstring fctName(L"Connection::closeRemoteResultSet");
+  const wchar_t fctName[] = L"Connection::closeRemoteResultSet";
   
   LockScope ls(&connectionCS);
 
@@ -978,7 +978,7 @@
 SQLWarning* Connection::getWarnings() throw (DriverException,
     UnexpectedException)
 {
-  const wstring fctName(L"Connection::getWarnings");
+  const wchar_t fctName[] = L"Connection::getWarnings";
 
   throwExceptionIfClosed(L"Cannot getWarnings() on a closed connection");
   if (!persistent_connection || !retrieve_sql_warnings)
@@ -997,7 +997,7 @@
 void Connection::clearWarnings() throw (DriverException,
     UnexpectedException)
 {
-  const wstring fctName(L"Connection::clearWarnings");
+  const wchar_t fctName[] = L"Connection::clearWarnings";
 
   if (!persistent_connection || !retrieve_sql_warnings)
     return;
@@ -1087,7 +1087,7 @@
     throw (SocketIOException, BackendException, ControllerException,
     ProtocolException, UnexpectedException)
 {
-  const wstring fctName(L"Connection::retrieveExecuteUpdateResult");
+  const wchar_t fctName[] = L"Connection::retrieveExecuteUpdateResult";
   if (isDebugEnabled())
     logDebug(fctName, L"Retrieving previous result of query "
         + toWString(request.getId()));
@@ -1173,7 +1173,7 @@
 void Connection::reconnectOrDie() throw (ConnectionException,
     DriverException, UnexpectedException)
 {
-  const wstring fctName(L"Connection::reconnectOrDie");
+  const wchar_t fctName[] = L"Connection::reconnectOrDie";
   bool reconnected = false;
   while (!reconnected)
   {
@@ -1200,7 +1200,7 @@
 void Connection::tryToReconnect() throw (NoMoreControllerException,
     DriverException, UnexpectedException)
 {
-  const wstring fctName(L"Connection::tryToReconnect");
+  const wchar_t fctName[] = L"Connection::tryToReconnect";
   //Wait until other methods/Commands are done
   LockScope ls(&connectionCS);
 
Index: carob/src/ControllerInfo.cpp
diff -u carob/src/ControllerInfo.cpp:1.14 carob/src/ControllerInfo.cpp:1.15
--- carob/src/ControllerInfo.cpp:1.14   Thu Jan 18 16:56:38 2007
+++ carob/src/ControllerInfo.cpp        Thu Jan 25 16:10:52 2007
@@ -76,7 +76,7 @@
 addrinfo* ControllerInfo::getAddrs(const std::wstring& name, in_port_t port)
     throw (ConnectionException, UnexpectedException)
 {
-  const wstring fctName(L"ControllerInfo::getAddrs");
+  const wchar_t fctName[] = L"ControllerInfo::getAddrs";
   char service[NI_MAXSERV];
   addrinfo*  addressList = NULL;
   addrinfo   hint;
@@ -126,7 +126,7 @@
 DriverSocket* ControllerInfo::connect(AbstractControllerPool& pool)
     throw (ConnectionException, UnexpectedException)
 {
-  const wstring fctName(L"ControllerInfo::connect()");
+  const wchar_t fctName[] = L"ControllerInfo::connect()";
 
   DriverSocket* socketPtr;
   try {
Index: carob/src/ControllerPingSender.cpp
diff -u carob/src/ControllerPingSender.cpp:1.6 
carob/src/ControllerPingSender.cpp:1.7
--- carob/src/ControllerPingSender.cpp:1.6      Tue Jan  9 20:36:05 2007
+++ carob/src/ControllerPingSender.cpp  Thu Jan 25 16:10:52 2007
@@ -54,7 +54,7 @@
 
 void ControllerPingSender::run()
 {
-  const wstring fctName(L"ControllerPingSender::run");
+  const wchar_t fctName[] = L"ControllerPingSender::run";
   if (isDebugEnabled())
     logDebug(fctName, L"Pinger started");
   java_byte packet[1];
Index: carob/src/ControllerPool.cpp
diff -u carob/src/ControllerPool.cpp:1.18 carob/src/ControllerPool.cpp:1.19
--- carob/src/ControllerPool.cpp:1.18   Thu Dec 21 23:23:17 2006
+++ carob/src/ControllerPool.cpp        Thu Jan 25 16:10:52 2007
@@ -158,7 +158,7 @@
 ControllerInfo RoundRobinControllerPool::getController()
     throw (NoMoreControllerException, UnexpectedException)
 {
-  const wstring fctName(L"RoundRobinControllerPool::getController");
+  const wchar_t fctName[] = L"RoundRobinControllerPool::getController";
   LockScope ls(&pool_CS);
   if (alive_controllers.empty())
     throw NoMoreControllerException(L"All controllers down");
@@ -251,7 +251,7 @@
 /*static*/
 void ControllerPoolManager::freePool(AbstractControllerPool* pool)
 {
-  const wstring fctName(L"ControllerPoolManager::freePool");
+  const wchar_t fctName[] = L"ControllerPoolManager::freePool";
   if (pool == NULL)
   {
     if (isErrorEnabled())
Index: carob/src/ControllerStateChangedCallback.cpp
diff -u carob/src/ControllerStateChangedCallback.cpp:1.6 
carob/src/ControllerStateChangedCallback.cpp:1.7
--- carob/src/ControllerStateChangedCallback.cpp:1.6    Wed Dec 20 19:38:41 2006
+++ carob/src/ControllerStateChangedCallback.cpp        Thu Jan 25 16:10:52 2007
@@ -85,7 +85,7 @@
 
 void SocketKillerCallback::onControllerDown(const ControllerInfo& ctrl)
 {
-  const wstring fctName(L"SocketKillerCallback::OnControllerDown");
+  const wchar_t fctName[] = L"SocketKillerCallback::OnControllerDown";
   // tell policy asap
   policy.controllerDown(ctrl);
   LockScope ls(&controllers_and_sockets_CS);
Index: carob/src/ControllerWatcher.cpp
diff -u carob/src/ControllerWatcher.cpp:1.13 
carob/src/ControllerWatcher.cpp:1.14
--- carob/src/ControllerWatcher.cpp:1.13        Wed Jan 10 18:22:33 2007
+++ carob/src/ControllerWatcher.cpp     Thu Jan 25 16:10:52 2007
@@ -63,7 +63,7 @@
       is_stopped(false)
       
 {
-  const wstring fctName(L"ControllerWatcher::ControllerWatcher");
+  const wchar_t fctName[] = L"ControllerWatcher::ControllerWatcher";
 
   controllers_ptr = new WatchedControllers(controllerList, 
getCurrentTimeInMs(),
       controllerTimeout, callbackPtr);
@@ -131,7 +131,7 @@
 
 void ControllerWatcher::processAnswers()
 {
-  const wstring fctName(L"ControllerWatcher::processAnswers");
+  const wchar_t fctName[] = L"ControllerWatcher::processAnswers";
   java_byte buf[1];
   sockaddr_storage respondingCtrlAddr;
   socklen_t respondingCtrlAddrLength = sizeof(sockaddr_storage);
@@ -168,7 +168,7 @@
 
 void ControllerWatcher::run()
 {
-  const wstring fctName(L"ControllerWatcher::run");
+  const wchar_t fctName[] = L"ControllerWatcher::run";
   if (isDebugEnabled())
   {
     logDebug(fctName, L"Watcher started");
Index: carob/src/DriverResultSet.cpp
diff -u carob/src/DriverResultSet.cpp:1.60 carob/src/DriverResultSet.cpp:1.61
--- carob/src/DriverResultSet.cpp:1.60  Wed Dec 20 19:38:41 2006
+++ carob/src/DriverResultSet.cpp       Thu Jan 25 16:10:52 2007
@@ -144,7 +144,7 @@
 owningStatementPtr(NULL),
 isClosed(true)
 {
-  const wstring fctName(L"DriverResultSet::DriverResultSet");
+  const wchar_t fctName[] = L"DriverResultSet::DriverResultSet";
   connectionPtr = conPtr;
   const DriverSocket&  socket = conPtr->getDriverSocket();
   bool hasWarnings = false;
Index: carob/src/JavaSocket.cpp
diff -u carob/src/JavaSocket.cpp:1.78 carob/src/JavaSocket.cpp:1.79
--- carob/src/JavaSocket.cpp:1.78       Fri Jan 19 15:37:29 2007
+++ carob/src/JavaSocket.cpp    Thu Jan 25 16:10:52 2007
@@ -200,7 +200,7 @@
 
 JavaSocket::~JavaSocket()
 {
-  const wstring fctName(L"JavaSocket::~JavaSocket");
+  const wchar_t fctName[] = L"JavaSocket::~JavaSocket";
 
   delete &utf8_codec;
 
@@ -220,7 +220,7 @@
 void JavaSocket::create(int domain)
     throw (ConnectionException, UnexpectedException)
 {
-  const wstring fctName(L"JavaSocket::Create");
+  const wchar_t fctName[] = L"JavaSocket::Create";
   if (isDebugEnabled())
     logDebug(fctName, L"Creating socket...");
 
@@ -261,7 +261,7 @@
 bool JavaSocket::connectTo(const SocketAddress& addr)
     throw (ConnectionException, UnexpectedException)
 {
-  const wstring fctName(L"JavaSocket::connectTo");
+  const wchar_t fctName[] = L"JavaSocket::connectTo";
   connected = false;
   if (!isValid())
   {
@@ -343,7 +343,7 @@
 
 bool JavaSocket::closeSocket() throw (SocketIOException, UnexpectedException)
 {
-  const wstring fctName(L"closeSocket");
+  const wchar_t fctName[] = L"closeSocket";
   if (isValid())
   {
     if (portable_close(this->socket_fd) != 0)
@@ -371,7 +371,7 @@
 size_t JavaSocket::writeJavaUTF(const wstring& str) const
   throw (SocketIOException, CodecException, UnexpectedException)
 {
-  const wstring fctName(L"JavaSocket::writeJavaUTF");
+  const wchar_t fctName[] = L"JavaSocket::writeJavaUTF";
 
   std::string utf8str;
 
@@ -397,7 +397,7 @@
 size_t JavaSocket::readJavaUTF(wstring& s) const
   throw (SocketIOException, CodecException, UnexpectedException)
 {
-  const wstring fctName(L"JavaSocket::readJavaUTF");
+  const wchar_t fctName[] = L"JavaSocket::readJavaUTF";
 
   int32_t lenRecNet;
   //the converted size
@@ -431,7 +431,7 @@
 void JavaSocket::writeJavaInt(int32_t i) const throw (SocketIOException,
     UnexpectedException)
 {
-  const wstring fctName(L"JavaSocket::WriteInt32");
+  const wchar_t fctName[] = L"JavaSocket::WriteInt32";
   // we have to convert the byte order
   int32_t conv = htonl(i);
   sendToSocket(fctName, L"Int32", &conv, sizeof(conv), SOCKET_SEND_FLAGS);
@@ -440,7 +440,7 @@
 void JavaSocket::readJavaInt(int32_t& i) const throw (SocketIOException,
     UnexpectedException)
 {
-  const wstring fctName(L"Socket::ReadInt32");
+  const wchar_t fctName[] = L"Socket::ReadInt32";
   // the data will be received with network byte order.
   // so we must convert it after reception
   int32_t rec = 0;
@@ -452,7 +452,7 @@
 void JavaSocket::writeJavaLong(int64_t i) const throw (SocketIOException,
     UnexpectedException)
 {
-  const wstring fctName(L"JavaSocket::writeJavaLong");
+  const wchar_t fctName[] = L"JavaSocket::writeJavaLong";
   // we have to convert the byte order
   int64_t conv = htonll(i);
   sendToSocket(fctName, L"Int64", &conv, sizeof(conv), SOCKET_SEND_FLAGS);
@@ -461,7 +461,7 @@
 void JavaSocket::readJavaLong(int64_t& i) const throw (SocketIOException,
     UnexpectedException)
 {
-  const wstring fctName(L"Socket::readJavaLong");
+  const wchar_t fctName[] = L"Socket::readJavaLong";
   // the data will be received with network byte order.
   // so we must convert it after reception
   int64_t rec = 0;
@@ -473,7 +473,7 @@
 void JavaSocket::writeJavaBool(bool b) const throw (SocketIOException,
     UnexpectedException)
 {
-  const wstring fctName(L"JavaSocket::writeJavaBool");
+  const wchar_t fctName[] = L"JavaSocket::writeJavaBool";
   uint8_t byteToSend = b; // the implicit casts do it right
   //No byte order problem here: the only value read is '0' for false
   //all other values are true
@@ -483,7 +483,7 @@
 void JavaSocket::readJavaBool(bool& b) const throw (SocketIOException,
     UnexpectedException)
 {
-  const wstring fctName(L"JavaSocket::readJavaBool");
+  const wchar_t fctName[] = L"JavaSocket::readJavaBool";
 
   uint8_t rec;
   receiveFromSocket(fctName, L"Boolean", &rec, sizeof(rec), 0);
@@ -493,14 +493,14 @@
 void JavaSocket::readJavaBytes(int32_t length, java_byte* data) const
     throw (SocketIOException, UnexpectedException)
 {
-  const wstring fctName(L"JavaSocket::readJavaBytes");
+  const wchar_t fctName[] = L"JavaSocket::readJavaBytes";
   receiveFromSocket(fctName, L"JavaBytes", data, length, 0);
 }
 
 void JavaSocket::writeJavaBytes(int32_t length, java_byte* data) const
     throw (SocketIOException, UnexpectedException)
 {
-  const wstring fctName(L"JavaSocket::writeJavaBytes");
+  const wchar_t fctName[] = L"JavaSocket::writeJavaBytes";
   sendToSocket(fctName, L"JavaBytes", data, length, SOCKET_SEND_FLAGS);
 }
 
Index: carob/src/Statement.cpp
diff -u carob/src/Statement.cpp:1.32 carob/src/Statement.cpp:1.33
--- carob/src/Statement.cpp:1.32        Wed Dec 20 19:38:41 2006
+++ carob/src/Statement.cpp     Thu Jan 25 16:10:52 2007
@@ -101,7 +101,7 @@
     throw (DriverException, SocketIOException, BackendException, 
ControllerException, ProtocolException,
         NotImplementedException, UnexpectedException)
 {
-  const wstring fctName(L"Statement::execute");
+  const wchar_t fctName[] = L"Statement::execute";
   if (isClosed())
   {
     throw DriverException(L"Unable to execute query on a closed statement");
@@ -126,7 +126,7 @@
     ControllerException, ProtocolException, NotImplementedException,
     UnexpectedException)
 {
-  const wstring fctName(L"Statement::executeQuery");
+  const wchar_t fctName[] = L"Statement::executeQuery";
   if (isClosed())
   {
     throw DriverException(L"Unable to execute query on a closed statement");
@@ -156,7 +156,7 @@
     throw (DriverException, SocketIOException, BackendException, 
         ControllerException, ProtocolException, UnexpectedException)
 {
-  const wstring fctName(L"Statement::executeUpdate");
+  const wchar_t fctName[] = L"Statement::executeUpdate";
   if (isClosed())
   {
     throw DriverException(L"Unable to execute query on a closed statement");
Index: carob/src/WatchedControllers.cpp
diff -u carob/src/WatchedControllers.cpp:1.5 
carob/src/WatchedControllers.cpp:1.6
--- carob/src/WatchedControllers.cpp:1.5        Thu Dec 21 23:23:17 2006
+++ carob/src/WatchedControllers.cpp    Thu Jan 25 16:10:52 2007
@@ -96,7 +96,7 @@
 
 void WatchedControllers::setControllerResponsed(const SocketAddress& ctrlAddr, 
long newTime)
 {
-  const wstring fctName(L"WatchedControllers::setControllerResponsed");
+  const wchar_t fctName[] = L"WatchedControllers::setControllerResponsed";
   LockScope ls(&controllers_CS);
   ControllerAndState& state = controllers[ctrlAddr];
   // Set the new time
@@ -114,7 +114,7 @@
 
 void WatchedControllers::lookForDeadControllers(long currentTime)
 {
-  const wstring fctName(L"WatchedControllers::lookForDeadControllers");
+  const wchar_t fctName[] = L"WatchedControllers::lookForDeadControllers";
   LockScope ls(&controllers_CS);
   for (map<SocketAddress, ControllerAndState>::iterator iter = 
controllers.begin();
       iter != controllers.end(); iter++)

_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits

Reply via email to