replace pointer with reference
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Mon, 12 Feb 2007 23:22:48 +0100
changeset 256 8978ff0dc351
parent 255 4355f8f37d89
child 257 60d6d9bb4f9a
replace pointer with reference
src/node/ipv4-address.cc
src/node/ipv4-address.h
--- a/src/node/ipv4-address.cc	Mon Feb 12 22:44:41 2007 +0100
+++ b/src/node/ipv4-address.cc	Mon Feb 12 23:22:48 2007 +0100
@@ -97,12 +97,12 @@
 }
 
 void 
-Ipv4Mask::Print (std::ostream *os) const
+Ipv4Mask::Print (std::ostream &os) const
 {
-  *os << ((m_mask >> 24) & 0xff) << "."
-      << ((m_mask >> 16) & 0xff) << "."
-      << ((m_mask >> 8) & 0xff) << "."
-      << ((m_mask >> 0) & 0xff);
+  os << ((m_mask >> 24) & 0xff) << "."
+     << ((m_mask >> 16) & 0xff) << "."
+     << ((m_mask >> 8) & 0xff) << "."
+     << ((m_mask >> 0) & 0xff);
 }
 
 
@@ -168,12 +168,12 @@
 }
 
 void 
-Ipv4Address::Print (std::ostream *os) const
+Ipv4Address::Print (std::ostream &os) const
 {
-  *os << ((m_address >> 24) & 0xff) << "."
-      << ((m_address >> 16) & 0xff) << "."
-      << ((m_address >> 8) & 0xff) << "."
-      << ((m_address >> 0) & 0xff);
+  os << ((m_address >> 24) & 0xff) << "."
+     << ((m_address >> 16) & 0xff) << "."
+     << ((m_address >> 8) & 0xff) << "."
+     << ((m_address >> 0) & 0xff);
 }
 
 
@@ -218,12 +218,12 @@
 
 std::ostream& operator<< (std::ostream& os, Ipv4Address const& address)
 {
-  address.Print (&os);
+  address.Print (os);
   return os;
 }
 std::ostream& operator<< (std::ostream& os, Ipv4Mask const& mask)
 {
-  mask.Print (&os);
+  mask.Print (os);
   return os;
 }
 
--- a/src/node/ipv4-address.h	Mon Feb 12 22:44:41 2007 +0100
+++ b/src/node/ipv4-address.h	Mon Feb 12 23:22:48 2007 +0100
@@ -52,7 +52,7 @@
   void SetHostOrder (uint32_t ip);
   void Serialize (uint8_t buf[4]) const;
 
-  void Print (std::ostream *os) const;
+  void Print (std::ostream &os) const;
 
   bool IsBroadcast (void);
   bool IsMulticast (void);
@@ -83,7 +83,7 @@
   uint32_t GetHostOrder (void) const;
   void SetHostOrder (uint32_t value);
 
-  void Print (std::ostream *os) const;
+  void Print (std::ostream &os) const;
 
   static Ipv4Mask GetLoopback (void);
   static Ipv4Mask GetZero (void);