List:Commits« Previous MessageNext Message »
From:Magnus Blåudd Date:April 4 2011 9:41am
Subject:bzr commit into mysql-5.1-telco-7.0 branch (magnus.blaudd:4276)
View as plain text  
#At file:///home/msvensson/mysql/7.0-ndbzio/ based on revid:magnus.blaudd@strippedfy

 4276 Magnus Blåudd	2011-04-04
      ndbzio
       - remove last uses of ndbzio_stream::file member
      - ndbzclose can be called on a closed file(it will check internally if file need to be closed)
       - remove useless memset in BackupFile destructor.
       - Remove initializations of ndbzio_stream::file to -1
       - Use return code from ndbzoen to determine if file open suceeded or not, don't 
        look at ndbzio_stream::file

    modified:
      storage/ndb/tools/restore/Restore.cpp
=== modified file 'storage/ndb/tools/restore/Restore.cpp'
--- a/storage/ndb/tools/restore/Restore.cpp	2011-04-04 09:37:59 +0000
+++ b/storage/ndb/tools/restore/Restore.cpp	2011-04-04 09:41:30 +0000
@@ -1297,7 +1297,6 @@ BackupFile::BackupFile(void (* _free_dat
   : free_data_callback(_free_data_callback)
 {
   memset(&m_file,0,sizeof(m_file));
-  m_file.file = -1;
   m_path[0] = 0;
   m_fileName[0] = 0;
 
@@ -1311,30 +1310,25 @@ BackupFile::BackupFile(void (* _free_dat
   m_is_undolog = false;
 }
 
-BackupFile::~BackupFile(){
-  if(m_file.file > 1)
-  {
-    ndbzclose(&m_file);
-    memset(&m_file,0,sizeof(m_file));
-  }
+BackupFile::~BackupFile()
+{
+  (void)ndbzclose(&m_file);
+
   if(m_buffer != 0)
     free(m_buffer);
 }
 
 bool
 BackupFile::openFile(){
-  if(m_file.file > 1){
-    ndbzclose(&m_file);
-    m_file.file = 0;
-    m_file_size = 0;
-    m_file_pos = 0;
-  }
+  (void)ndbzclose(&m_file);
+  m_file_size = 0;
+  m_file_pos = 0;
 
   info.setLevel(254);
   info << "Opening file '" << m_fileName << "'\n";
   int r= ndbzopen(&m_file, m_fileName, O_RDONLY);
 
-  if(m_file.file < 0)
+  if(r != 1)
     return false;
 
   size_t size;

Attachment: [text/bzr-bundle] bzr/magnus.blaudd@oracle.com-20110404094130-xwdm3dgr6oj5d5jk.bundle
Thread
bzr commit into mysql-5.1-telco-7.0 branch (magnus.blaudd:4276) Magnus Blåudd4 Apr