diff options
author | Mauro Sardara <msardara@cisco.com> | 2019-07-08 15:00:58 +0200 |
---|---|---|
committer | Mauro Sardara <msardara@cisco.com> | 2019-07-08 16:45:04 +0200 |
commit | 63422dfdcb1cd6827e76440cc147c9eac415952a (patch) | |
tree | aeafaffb0e1f7a68c823611609e21983f51f5d0e /libtransport/src/hicn/transport/core/interest.cc | |
parent | 87cd4b4d22a08f1b56cd067770a29bcb05ebb845 (diff) |
[HICN-242] Perform only one allocation for the whole buffer passed to produce()
Change-Id: Ib4628d0a7711e2d7175b3dbb5c152dd22616ff32
Signed-off-by: Mauro Sardara <msardara@cisco.com>
Diffstat (limited to 'libtransport/src/hicn/transport/core/interest.cc')
-rw-r--r-- | libtransport/src/hicn/transport/core/interest.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libtransport/src/hicn/transport/core/interest.cc b/libtransport/src/hicn/transport/core/interest.cc index e7d47d565..60ab10967 100644 --- a/libtransport/src/hicn/transport/core/interest.cc +++ b/libtransport/src/hicn/transport/core/interest.cc @@ -34,7 +34,7 @@ namespace core { Interest::Interest(const Name &interest_name, Packet::Format format) : Packet(format) { if (hicn_interest_set_name(format_, packet_start_, - interest_name.getStructReference()) < 0) { + interest_name.getConstStructReference()) < 0) { throw errors::MalformedPacketException(); } @@ -44,7 +44,6 @@ Interest::Interest(const Name &interest_name, Packet::Format format) } } - #ifdef __ANDROID__ Interest::Interest(hicn_format_t format) : Interest(Name("0::0|0"), format) {} #else @@ -85,7 +84,8 @@ void Interest::replace(MemBufPtr &&buffer) { const Name &Interest::getName() const { if (!name_) { if (hicn_interest_get_name(format_, packet_start_, - (hicn_name_t *)name_.getStructReference()) < 0) { + (hicn_name_t *)name_.getConstStructReference()) < + 0) { throw errors::MalformedPacketException(); } } @@ -97,7 +97,7 @@ Name &Interest::getWritableName() { return const_cast<Name &>(getName()); } void Interest::setName(const Name &name) { if (hicn_interest_set_name(format_, packet_start_, - name.getStructReference()) < 0) { + name.getConstStructReference()) < 0) { throw errors::RuntimeException("Error setting interest name."); } |