myserver-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[myserver-commit] [SCM] GNU MyServer branch, master, updated. v0.9.2-230


From: Giuseppe Scrivano
Subject: [myserver-commit] [SCM] GNU MyServer branch, master, updated. v0.9.2-230-g6ba713c
Date: Wed, 12 May 2010 08:18:18 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU MyServer".

The branch, master has been updated
       via  6ba713c332131f33796539a9ee504cdef6a51bb1 (commit)
      from  17673a34336b925fa10a30f98331d60efe2891b2 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------


commit 6ba713c332131f33796539a9ee504cdef6a51bb1
Author: Giuseppe Scrivano <address@hidden>
Date:   Wed May 12 10:18:38 2010 +0200

    Avoid some memory allocations.

diff --git a/myserver/include/connection/connection.h 
b/myserver/include/connection/connection.h
index c18eb09..eb7360e 100644
--- a/myserver/include/connection/connection.h
+++ b/myserver/include/connection/connection.h
@@ -131,11 +131,11 @@ public:
   /*! Check if the connection/connection.has a continuation.  */
   bool hasContinuation (){return continuation ? true : false;}
 
-  MemBuf *getConnectionBuffer (){return connectionBuffer;}
+  MemBuf *getConnectionBuffer (){return &connectionBuffer;}
 protected:
 
   /*! This buffer must be used only by the ClientsTHREAD class.  */
-  MemBuf *connectionBuffer;
+  MemBuf connectionBuffer;
 
   ClientsThread *thread;
 
@@ -152,19 +152,19 @@ protected:
   u_short port;
 
   /*! Login name.  */
-  string *login;
+  string login;
 
   /*! Password used to log in.  */
-  string *password;
+  string password;
 
   /*! # of tries for an authorized login.  */
   char nTries;
 
   /*! Remote IP address.  */
-  string *ipAddr;
+  string ipAddr;
 
   /*! Local IP used to connect to.  */
-  string *localIpAddr;
+  string localIpAddr;
 
   /*! Local port used to connect to.  */
   u_short localPort;
diff --git a/myserver/src/connection/connection.cpp 
b/myserver/src/connection/connection.cpp
index 5091544..be457e4 100644
--- a/myserver/src/connection/connection.cpp
+++ b/myserver/src/connection/connection.cpp
@@ -28,10 +28,6 @@ void Connection::init ()
 {
   thread = 0;
   scheduled = 0;
-  login = new string ();
-  password = new string ();
-  ipAddr = new string ();
-  localIpAddr = new string ();
   nTries = 0;
   port = 0;
   localPort = 0;
@@ -43,7 +39,6 @@ void Connection::init ()
   socket = NULL;
   priority = -1;
   continuation = NULL;
-       connectionBuffer = new MemBuf ();
 }
 
 /*!
@@ -65,21 +60,6 @@ void Connection::destroy ()
         }
     }
 
-  if (login)
-    delete login;
-
-  if (password)
-    delete password;
-
-  if (ipAddr)
-    delete ipAddr;
-
-  if (localIpAddr)
-    delete localIpAddr;
-
-  if (connectionBuffer)
-    delete connectionBuffer;
-
   if (protocolBuffer)
     delete protocolBuffer;
 
@@ -87,12 +67,7 @@ void Connection::destroy ()
   if (host)
     ((Vhost*) host)->removeRef ();
 
-  login = NULL;
-  password = NULL;
-  ipAddr = NULL;
-  localIpAddr = NULL;
   protocolBuffer = NULL;
-  connectionBuffer = NULL;
 
   host = NULL;
 }
@@ -167,7 +142,7 @@ void Connection::setPort (u_short newPort)
  */
 const char* Connection::getLogin ()
 {
-  return login->c_str ();
+  return login.c_str ();
 }
 
 /*!
@@ -176,7 +151,7 @@ const char* Connection::getLogin ()
  */
 void Connection::setLogin (const char* loginName)
 {
-  login->assign (loginName);
+  login.assign (loginName);
 }
 
 /*!
@@ -208,7 +183,7 @@ void Connection::incnTries ()
  */
 const char* Connection::getIpAddr ()
 {
-  return ipAddr->c_str ();
+  return ipAddr.c_str ();
 }
 
 /*!
@@ -217,7 +192,7 @@ const char* Connection::getIpAddr ()
  */
 void Connection::setIpAddr (const char* na)
 {
-  ipAddr->assign (na);
+  ipAddr.assign (na);
 }
 
 /*!
@@ -225,7 +200,7 @@ void Connection::setIpAddr (const char* na)
  */
 const char* Connection::getLocalIpAddr ()
 {
-  return localIpAddr->c_str ();
+  return localIpAddr.c_str ();
 }
 
 /*!
@@ -234,7 +209,7 @@ const char* Connection::getLocalIpAddr ()
  */
 void Connection::setLocalIpAddr (const char* na)
 {
-  localIpAddr->assign (na);
+  localIpAddr.assign (na);
 }
 
 /*!
@@ -309,7 +284,7 @@ void Connection::setForceControl (int fp)
  */
 const char* Connection::getPassword ()
 {
-  return password->c_str ();
+  return password.c_str ();
 }
 
 /*!
@@ -318,7 +293,7 @@ const char* Connection::getPassword ()
  */
 void Connection::setPassword (const char* p)
 {
-  password->assign (p);
+  password.assign (p);
 }
 
 /*!

-----------------------------------------------------------------------

Summary of changes:
 myserver/include/connection/connection.h |   12 ++++----
 myserver/src/connection/connection.cpp   |   41 ++++++------------------------
 2 files changed, 14 insertions(+), 39 deletions(-)


hooks/post-receive
-- 
GNU MyServer



reply via email to

[Prev in Thread] Current Thread [Next in Thread]