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 "CMake".

The branch, next has been updated
       via  e951857e6a54a6920e4ab9d198c4d6a4612285bd (commit)
       via  7762fffa238a9bbc28658742792c25c10a7cc9c5 (commit)
      from  f1971971c9c23f1d2819d64e189ce01a15362ac4 (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 -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e951857e6a54a6920e4ab9d198c4d6a4612285bd
commit e951857e6a54a6920e4ab9d198c4d6a4612285bd
Merge: f197197 7762fff
Author:     Bill Hoffman <bill.hoff...@kitware.com>
AuthorDate: Mon Aug 4 15:20:39 2014 -0400
Commit:     CMake Topic Stage <kwro...@kitware.com>
CommitDate: Mon Aug 4 15:20:39 2014 -0400

    Merge topic 'pass_output_by_reference' into next
    
    7762fffa Change output to be a reference and not a pointer.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7762fffa238a9bbc28658742792c25c10a7cc9c5
commit 7762fffa238a9bbc28658742792c25c10a7cc9c5
Author:     Bill Hoffman <bill.hoff...@kitware.com>
AuthorDate: Mon Aug 4 15:16:40 2014 -0400
Commit:     Bill Hoffman <bill.hoff...@kitware.com>
CommitDate: Mon Aug 4 15:16:40 2014 -0400

    Change output to be a reference and not a pointer.
    
    This avoids having to check the pointer value at each use which
    was not being done.

diff --git a/Source/CTest/cmCTestConfigureHandler.cxx 
b/Source/CTest/cmCTestConfigureHandler.cxx
index a6e39a4..c492bf0 100644
--- a/Source/CTest/cmCTestConfigureHandler.cxx
+++ b/Source/CTest/cmCTestConfigureHandler.cxx
@@ -77,7 +77,7 @@ int cmCTestConfigureHandler::ProcessHandler()
     this->StartLogFile("Configure", ofs);
     cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Configure with command: "
       << cCommand << std::endl);
-    res = this->CTest->RunMakeCommand(cCommand.c_str(), &output,
+    res = this->CTest->RunMakeCommand(cCommand.c_str(), output,
       &retVal, buildDirectory.c_str(),
       0, ofs);
 
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index d797d3b..b28f3b5 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -1147,7 +1147,7 @@ int cmCTest::GetTestModelFromString(const char* str)
 //######################################################################
 
 //----------------------------------------------------------------------
-int cmCTest::RunMakeCommand(const char* command, std::string* output,
+int cmCTest::RunMakeCommand(const char* command, std::string& output,
   int* retVal, const char* dir, int timeout, std::ostream& ofs)
 {
   // First generate the command and arguments
@@ -1166,11 +1166,7 @@ int cmCTest::RunMakeCommand(const char* command, 
std::string* output,
     }
   argv.push_back(0);
 
-  if ( output )
-    {
-    *output = "";
-    }
-
+  output = "";
   cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, "Run command:");
   std::vector<const char*>::iterator ait;
   for ( ait = argv.begin(); ait != argv.end() && *ait; ++ ait )
@@ -1199,27 +1195,25 @@ int cmCTest::RunMakeCommand(const char* command, 
std::string* output,
     << "    " << std::flush);
   while(cmsysProcess_WaitForData(cp, &data, &length, 0))
     {
-    if ( output )
+    for(int cc =0; cc < length; ++cc)
       {
-      for(int cc =0; cc < length; ++cc)
+      if(data[cc] == 0)
         {
-        if(data[cc] == 0)
-          {
-          data[cc] = '\n';
-          }
+        data[cc] = '\n';
         }
-
-      output->append(data, length);
-      while ( output->size() > (tick * tick_len) )
+      }
+    output.append(data, length);
+    while ( output.size() > (tick * tick_len) )
+      {
+      tick ++;
+      cmCTestLog(this, HANDLER_OUTPUT, "." << std::flush);
+      if ( tick % tick_line_len == 0 && tick > 0 )
         {
-        tick ++;
-        cmCTestLog(this, HANDLER_OUTPUT, "." << std::flush);
-        if ( tick % tick_line_len == 0 && tick > 0 )
-          {
-          cmCTestLog(this, HANDLER_OUTPUT, "  Size: "
-            << int((double(output->size()) / 1024.0) + 1) << "K" << std::endl
-            << "    " << std::flush);
-          }
+        cmCTestLog(this, HANDLER_OUTPUT,
+                   "  Size: "
+                   << int((double(output.size()) / 1024.0) + 1)
+                   << "K" << std::endl
+                   << "    " << std::flush);
         }
       }
     cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, cmCTestLogWrite(data, length));
@@ -1229,7 +1223,7 @@ int cmCTest::RunMakeCommand(const char* command, 
std::string* output,
       }
     }
   cmCTestLog(this, OUTPUT, " Size of output: "
-    << int(double(output->size()) / 1024.0) << "K" << std::endl);
+    << int(double(output.size()) / 1024.0) << "K" << std::endl);
 
   cmsysProcess_WaitForExit(cp, 0);
 
@@ -1253,9 +1247,9 @@ int cmCTest::RunMakeCommand(const char* command, 
std::string* output,
     }
   else if(result == cmsysProcess_State_Error)
     {
-    *output += "\n*** ERROR executing: ";
-    *output += cmsysProcess_GetErrorString(cp);
-    *output += "\n***The build process failed.";
+    output += "\n*** ERROR executing: ";
+    output += cmsysProcess_GetErrorString(cp);
+    output += "\n***The build process failed.";
     cmCTestLog(this, ERROR_MESSAGE, "There was an error: "
       << cmsysProcess_GetErrorString(cp) << std::endl);
     }
diff --git a/Source/cmCTest.h b/Source/cmCTest.h
index 246294f..e19d32c 100644
--- a/Source/cmCTest.h
+++ b/Source/cmCTest.h
@@ -271,7 +271,7 @@ public:
 
   //! Run command specialized for make and configure. Returns process status
   // and retVal is return value or exception.
-  int RunMakeCommand(const char* command, std::string* output,
+  int RunMakeCommand(const char* command, std::string& output,
     int* retVal, const char* dir, int timeout,
     std::ostream& ofs);
 

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

Summary of changes:
 Source/CTest/cmCTestConfigureHandler.cxx |    2 +-
 Source/cmCTest.cxx                       |   48 +++++++++++++-----------------
 Source/cmCTest.h                         |    2 +-
 3 files changed, 23 insertions(+), 29 deletions(-)


hooks/post-receive
-- 
CMake
_______________________________________________
Cmake-commits mailing list
Cmake-commits@cmake.org
http://public.kitware.com/mailman/listinfo/cmake-commits

Reply via email to