List:Commits« Previous MessageNext Message »
From:jonas oreland Date:December 14 2010 12:55pm
Subject:bzr push into mysql-5.1-telco-7.0 branch (jonas:4057 to 4058)
View as plain text  
 4058 jonas oreland	2010-12-14
      ndb - add constructor to BaseString for non null-terminated strings

    modified:
      storage/ndb/include/util/BaseString.hpp
      storage/ndb/src/common/util/BaseString.cpp
 4057 jonas oreland	2010-12-14
      ndb - move 10ms polling from threadMainReceiv to ClusterMgr::threadMain

    modified:
      storage/ndb/src/ndbapi/ClusterMgr.cpp
      storage/ndb/src/ndbapi/ClusterMgr.hpp
      storage/ndb/src/ndbapi/TransporterFacade.cpp
      storage/ndb/src/ndbapi/trp_client.cpp
      storage/ndb/src/ndbapi/trp_client.hpp
=== modified file 'storage/ndb/include/util/BaseString.hpp'
--- a/storage/ndb/include/util/BaseString.hpp	2010-09-21 07:36:08 +0000
+++ b/storage/ndb/include/util/BaseString.hpp	2010-12-14 12:53:32 +0000
@@ -35,6 +35,9 @@ public:
   /** @brief Constructs a copy of a char * */
   BaseString(const char* s);
 
+  /** @brief Constructs a copy of a char * with length */
+  BaseString(const char* s, size_t len);
+
   /** @brief Constructs a copy of another BaseString */
   BaseString(const BaseString& str);
 

=== modified file 'storage/ndb/src/common/util/BaseString.cpp'
--- a/storage/ndb/src/common/util/BaseString.cpp	2010-11-28 11:34:01 +0000
+++ b/storage/ndb/src/common/util/BaseString.cpp	2010-12-14 12:53:32 +0000
@@ -54,6 +54,26 @@ BaseString::BaseString(const char* s)
     m_len = n;
 }
 
+BaseString::BaseString(const char * s, size_t n)
+{
+  if (s == NULL || n == 0)
+  {
+    m_chr = NULL;
+    m_len = 0;
+    return;
+  }
+  m_chr = new char[n + 1];
+  if (m_chr == NULL)
+  {
+    errno = ENOMEM;
+    m_len = 0;
+    return;
+  }
+  memcpy(m_chr, s, n);
+  m_chr[n] = 0;
+  m_len = n;
+}
+
 BaseString::BaseString(const BaseString& str)
 {
     const char* const s = str.m_chr;

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.1-telco-7.0 branch (jonas:4057 to 4058) jonas oreland14 Dec