BIND 10 trac2369, updated. dce5a5557d44d52455e9cfbafe2ad882e6b930db [2369] Use prefix syntax for increment/decrement operators

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Nov 7 07:02:23 UTC 2012


The branch, trac2369 has been updated
       via  dce5a5557d44d52455e9cfbafe2ad882e6b930db (commit)
      from  24862b62d9a01d277ea5c5b99666f04b1951de64 (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 dce5a5557d44d52455e9cfbafe2ad882e6b930db
Author: Mukund Sivaraman <muks at isc.org>
Date:   Wed Nov 7 12:31:30 2012 +0530

    [2369] Use prefix syntax for increment/decrement operators

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

Summary of changes:
 src/lib/dns/master_lexer_inputsource.cc            |    9 +++++----
 .../dns/tests/master_lexer_inputsource_unittest.cc |   12 ++++++------
 2 files changed, 11 insertions(+), 10 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/dns/master_lexer_inputsource.cc b/src/lib/dns/master_lexer_inputsource.cc
index 5d8d413..e6d9cec 100644
--- a/src/lib/dns/master_lexer_inputsource.cc
+++ b/src/lib/dns/master_lexer_inputsource.cc
@@ -96,9 +96,10 @@ InputSource::getChar() {
         buffer_.push_back(c);
     }
 
-    const int c = buffer_[buffer_pos_++];
+    const int c = buffer_[buffer_pos_];
+    ++buffer_pos_;
     if (c == '\n') {
-        line_++;
+        ++line_;
     }
 
     return (c);
@@ -112,9 +113,9 @@ InputSource::ungetChar() {
         isc_throw(UngetBeforeBeginning,
                   "Cannot skip before the start of buffer");
     } else {
-        buffer_pos_--;
+        --buffer_pos_;
         if (buffer_[buffer_pos_] == '\n') {
-            line_--;
+            --line_;
         }
     }
 }
diff --git a/src/lib/dns/tests/master_lexer_inputsource_unittest.cc b/src/lib/dns/tests/master_lexer_inputsource_unittest.cc
index 6541855..db0cbec 100644
--- a/src/lib/dns/tests/master_lexer_inputsource_unittest.cc
+++ b/src/lib/dns/tests/master_lexer_inputsource_unittest.cc
@@ -71,7 +71,7 @@ void
 checkGetAndUngetChar(InputSource& source,
                      const char* str, const size_t str_length)
 {
-    for (size_t i = 0; i < str_length; i++) {
+    for (size_t i = 0; i < str_length; ++i) {
         EXPECT_EQ(str[i], source.getChar());
         EXPECT_FALSE(source.atEOF());
     }
@@ -101,7 +101,7 @@ checkGetAndUngetChar(InputSource& source,
     // Now, let's go backwards in a loop. Start by skipping the EOF.
     source.ungetChar();
 
-    for (size_t i = 0; i < str_length; i++) {
+    for (size_t i = 0; i < str_length; ++i) {
         const size_t index = str_length - 1 - i;
         // Skip one character.
         source.ungetChar();
@@ -153,7 +153,7 @@ TEST_F(InputSourceTest, compact) {
     // Ungetting here must throw.
     EXPECT_THROW(source_.ungetChar(), InputSource::UngetBeforeBeginning);
 
-    for (size_t i = 0; i < str_length_; i++) {
+    for (size_t i = 0; i < str_length_; ++i) {
         EXPECT_EQ(str_[i], source_.getChar());
         EXPECT_FALSE(source_.atEOF());
     }
@@ -206,7 +206,7 @@ TEST_F(InputSourceTest, markDuring) {
     // Ungetting here must throw.
     EXPECT_THROW(source_.ungetChar(), InputSource::UngetBeforeBeginning);
 
-    for (size_t i = 13; i < str_length_; i++) {
+    for (size_t i = 13; i < str_length_; ++i) {
         EXPECT_EQ(str_[i], source_.getChar());
         EXPECT_FALSE(source_.atEOF());
     }
@@ -226,7 +226,7 @@ TEST_F(InputSourceTest, markDuring) {
     // Ungetting here must throw.
     EXPECT_THROW(source_.ungetChar(), InputSource::UngetBeforeBeginning);
 
-    for (size_t i = 13; i < str_length_; i++) {
+    for (size_t i = 13; i < str_length_; ++i) {
         EXPECT_EQ(str_[i], source_.getChar());
         EXPECT_FALSE(source_.atEOF());
     }
@@ -246,7 +246,7 @@ TEST_F(InputSourceTest, lines) {
     size_t line = 1;
     while (!source_.atEOF()) {
         if (source_.getChar() == '\n') {
-            line++;
+            ++line;
         }
         EXPECT_EQ(line, source_.getCurrentLine());
     }



More information about the bind10-changes mailing list