summaryrefslogtreecommitdiff
path: root/src/network/core/tcp_content.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/core/tcp_content.cpp')
-rw-r--r--src/network/core/tcp_content.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/network/core/tcp_content.cpp b/src/network/core/tcp_content.cpp
index 897570a91..b5bf52999 100644
--- a/src/network/core/tcp_content.cpp
+++ b/src/network/core/tcp_content.cpp
@@ -27,6 +27,21 @@ ContentInfo::~ContentInfo()
free(this->tags);
}
+/**
+ * Copy data from other #ContentInfo and take ownership of allocated stuff.
+ * @param other Source to copy from. #dependencies and #tags will be NULLed.
+ */
+void ContentInfo::TransferFrom(ContentInfo *other)
+{
+ if (other != this) {
+ free(this->dependencies);
+ free(this->tags);
+ memcpy(this, other, sizeof(ContentInfo));
+ other->dependencies = NULL;
+ other->tags = NULL;
+ }
+}
+
size_t ContentInfo::Size() const
{
size_t len = 0;