From 3cb9664414f4f5ace8dad227f5714ea412368126 Mon Sep 17 00:00:00 2001 From: Brian Aker Date: Sat, 30 Jun 2012 10:02:43 -0700 Subject: [PATCH] Update libtest --- libtest/cmdline.cc | 15 +++++++-------- libtest/vchar.cc | 1 + 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libtest/cmdline.cc b/libtest/cmdline.cc index ecce3299..1233f514 100644 --- a/libtest/cmdline.cc +++ b/libtest/cmdline.cc @@ -84,7 +84,7 @@ namespace { { std::stringstream arg_buffer; - for (size_t x= 0; x < argc; x++) + for (size_t x= 0; x < argc; ++x) { arg_buffer << built_argv[x] << " "; } @@ -96,7 +96,7 @@ namespace { { std::stringstream arg_buffer; - for (char** ptr= argv; *ptr; ptr++) + for (char** ptr= argv; *ptr; ++ptr) { arg_buffer << *ptr << " "; } @@ -526,7 +526,7 @@ bool Application::Pipe::read(libtest::vchar_t& arg) data_was_read= true; arg.reserve(read_length +1); - for (size_t x= 0; x < read_length; x++) + for (size_t x= 0; x < read_length; ++x) { arg.push_back(buffer[x]); } @@ -628,7 +628,6 @@ void Application::Pipe::close(const close_t& arg) if (_open[type]) { - int ret; if (::close(_pipe_fd[type]) == -1) { Error << "close(" << strerror(errno) << ")"; @@ -669,7 +668,7 @@ void Application::create_argv(const char *args[]) _argc+= 1; } - for (Options::const_iterator iter= _options.begin(); iter != _options.end(); iter++) + for (Options::const_iterator iter= _options.begin(); iter != _options.end(); ++iter) { _argc++; if ((*iter).second.empty() == false) @@ -771,9 +770,9 @@ std::string Application::arguments() { std::stringstream arg_buffer; - for (size_t x= 1 + _use_libtool ? 2 : 0; + for (size_t x= (1 +_use_libtool) ? 2 : 0; x < _argc and built_argv[x]; - x++) + ++x) { arg_buffer << built_argv[x] << " "; } @@ -785,7 +784,7 @@ void Application::delete_argv() { if (built_argv) { - for (size_t x= 0; x < _argc; x++) + for (size_t x= 0; x < _argc; ++x) { if (built_argv[x]) { diff --git a/libtest/vchar.cc b/libtest/vchar.cc index fde0127f..24238060 100644 --- a/libtest/vchar.cc +++ b/libtest/vchar.cc @@ -81,6 +81,7 @@ void make(libtest::vchar_t& arg) void make(libtest::vchar_t& arg, size_t length) { + arg.reserve(length); for (uint32_t x= 0; x < length; x++) { arg.push_back(char(x % 127)); -- 2.30.2