Browse Source

[4206b] Minor updates to the Pkt4::getLabel method.

The warning about malformed client-id is separated by a single
space character from the actual label. Also, used stream object
to concatenate label with suffix to be consistent with the
convention used in makeLabel.
Marcin Siodelski 9 years ago
parent
commit
a158b3d5f2
1 changed files with 7 additions and 5 deletions
  1. 7 5
      src/lib/dhcp/pkt4.cc

+ 7 - 5
src/lib/dhcp/pkt4.cc

@@ -352,20 +352,22 @@ Pkt4::getLabel() const {
             client_id = ClientIdPtr(new ClientId(client_opt->getData()));
         } catch (...) {
             // ClientId may throw if the client-id is too short.
-            suffix = "(malformed client-id)";
+            suffix = " (malformed client-id)";
         }
     }
 
-    std::string txt;
+    std::ostringstream label;
     try {
-        txt = makeLabel(hwaddr_, client_id, transid_);
+        label << makeLabel(hwaddr_, client_id, transid_);
     } catch (...) {
         // This should not happen with the current code, but we may add extra
         // sanity checks in the future that would possibly throw if
         // the hwaddr lenght is 0.
-        txt = "(malformed hw address)";
+        label << " (malformed hw address)";
     }
-    return (txt + suffix);
+
+    label << suffix;
+    return (label.str());
 }
 
 std::string