]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2512] Update check to an assertion
authorMukund Sivaraman <muks@isc.org>
Thu, 6 Feb 2014 12:21:17 +0000 (17:51 +0530)
committerMukund Sivaraman <muks@isc.org>
Thu, 6 Feb 2014 12:21:19 +0000 (17:51 +0530)
All the constructors currently check that the tag field is not empty.

src/lib/dns/rdata/generic/caa_257.cc

index 47366d651a9b5f79fff7e1cf580eebe6dbbb7892..ecaf5595913191352d41fc3be009b43c3a7b67e2 100644 (file)
@@ -242,11 +242,12 @@ CAA::~CAA() {
 void
 CAA::toWire(OutputBuffer& buffer) const {
     buffer.writeUint8(impl_->flags_);
+
+    // The constructors must ensure that the tag field is not empty.
+    assert(!impl_->tag_.empty());
     buffer.writeUint8(impl_->tag_.size());
-    if (!impl_->tag_.empty()) {
-        buffer.writeData(&impl_->tag_[0],
-                         impl_->tag_.size());
-    }
+    buffer.writeData(&impl_->tag_[0], impl_->tag_.size());
+
     if (impl_->value_.size() > 1) {
         buffer.writeData(&impl_->value_[1],
                          impl_->value_.size() - 1);
@@ -256,11 +257,12 @@ CAA::toWire(OutputBuffer& buffer) const {
 void
 CAA::toWire(AbstractMessageRenderer& renderer) const {
     renderer.writeUint8(impl_->flags_);
+
+    // The constructors must ensure that the tag field is not empty.
+    assert(!impl_->tag_.empty());
     renderer.writeUint8(impl_->tag_.size());
-    if (!impl_->tag_.empty()) {
-        renderer.writeData(&impl_->tag_[0],
-                           impl_->tag_.size());
-    }
+    renderer.writeData(&impl_->tag_[0], impl_->tag_.size());
+
     if (impl_->value_.size() > 1) {
         renderer.writeData(&impl_->value_[1],
                            impl_->value_.size() - 1);