Browse Source

[2726] Use empty() instead of size()

To check if there's something inside.
Michal 'vorner' Vaner 12 years ago
parent
commit
b6f5648870
2 changed files with 5 additions and 5 deletions
  1. 4 4
      src/lib/dns/rdata/any_255/tsig_250.cc
  2. 1 1
      src/lib/log/message_reader.cc

+ 4 - 4
src/lib/dns/rdata/any_255/tsig_250.cc

@@ -370,13 +370,13 @@ TSIG::toText() const {
         lexical_cast<string>(impl_->time_signed_) + " " +
         lexical_cast<string>(impl_->fudge_) + " " +
         lexical_cast<string>(impl_->mac_.size()) + " ";
-    if (impl_->mac_.size() > 0) {
+    if (!impl_->mac_.empty()) {
         result += encodeBase64(impl_->mac_) + " ";
     }
     result += lexical_cast<string>(impl_->original_id_) + " ";
     result += TSIGError(impl_->error_).toText() + " ";
     result += lexical_cast<string>(impl_->other_data_.size());
-    if (impl_->other_data_.size() > 0) {
+    if (!impl_->other_data_.empty()) {
         result += " " + encodeBase64(impl_->other_data_);
     }
 
@@ -520,7 +520,7 @@ TSIG::getMACSize() const {
 
 const void*
 TSIG::getMAC() const {
-    if (impl_->mac_.size() > 0) {
+    if (!impl_->mac_.empty()) {
         return (&impl_->mac_[0]);
     } else {
         return (NULL);
@@ -544,7 +544,7 @@ TSIG::getOtherLen() const {
 
 const void*
 TSIG::getOtherData() const {
-    if (impl_->other_data_.size() > 0) {
+    if (!impl_->other_data_.empty()) {
         return (&impl_->other_data_[0]);
     } else {
         return (NULL);

+ 1 - 1
src/lib/log/message_reader.cc

@@ -127,7 +127,7 @@ void
 MessageReader::parsePrefix(const vector<string>& tokens) {
 
     // Should not get here unless there is something in the tokens array.
-    assert(tokens.size() > 0);
+    assert(!tokens.empty());
 
     // Process $PREFIX.  With no arguments, the prefix is set to the empty
     // string.  One argument sets the prefix to the to its value and more than