projects
/
swifty.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
89845b9
)
Override the assignment operator for the Address class.
author
Adrian Bondrescu
<adi.bondrescu@gmail.com>
Thu, 31 May 2012 23:31:31 +0000
(
02:31
+0300)
committer
Adrian Bondrescu
<adi.bondrescu@gmail.com>
Thu, 31 May 2012 23:31:31 +0000
(
02:31
+0300)
src/libswift/swift.h
patch
|
blob
|
history
diff --git
a/src/libswift/swift.h
b/src/libswift/swift.h
index
2a9f68a
..
d44b882
100644
(file)
--- a/
src/libswift/swift.h
+++ b/
src/libswift/swift.h
@@
-134,6
+134,15
@@
namespace swift {
}
uint32_t ipv4 () const { return ntohl(addr->dests[0].addr); }
uint16_t port () const { return ntohs(addr->dests[0].port); }
+ Address& operator = (const Address& b) {
+ if (this != &b) {
+ free(addr);
+ clear();
+ addr->dests[0].addr = b.addr->dests[0].addr;
+ addr->dests[0].port = b.addr->dests[0].port;
+ }
+ return *this;
+ }
bool operator == (const Address& b) const {
return addr->count == b.addr->count &&
addr->dests[0].port==b.addr->dests[0].port &&