aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/salticidae/stream.h3
-rw-r--r--src/stream.cpp15
2 files changed, 4 insertions, 14 deletions
diff --git a/include/salticidae/stream.h b/include/salticidae/stream.h
index 37786b2..50a67dd 100644
--- a/include/salticidae/stream.h
+++ b/include/salticidae/stream.h
@@ -505,8 +505,7 @@ datastream_t *datastream_new();
datastream_t *datastream_new_from_bytes(const uint8_t *base, size_t size);
void datastream_free(const datastream_t *self);
-bool datastream_assign_by_copy(datastream_t *dst, const datastream_t *src);
-bool datastream_assign_by_move(datastream_t *dst, datastream_t *_moved_src);
+datastream_t *datastream_copy(const datastream_t *self);
uint8_t *datastream_data(datastream_t *self);
void datastream_clear(datastream_t *self);
size_t datastream_size(const datastream_t *self);
diff --git a/src/stream.cpp b/src/stream.cpp
index 13ee98f..71a5b27 100644
--- a/src/stream.cpp
+++ b/src/stream.cpp
@@ -41,19 +41,10 @@ datastream_t *datastream_new_from_bytes(const uint8_t *base, size_t size) {
void datastream_free(const datastream_t *self) { delete self; }
-bool datastream_assign_by_copy(datastream_t *dst, const datastream_t *src) {
+datastream_t *datastream_copy(const datastream_t *self) {
try {
- *dst = *src;
- } catch (...) { return false; }
- return true;
-}
-
-bool datastream_assign_by_move(datastream_t *dst, datastream_t *_moved_src) {
- try {
- *dst = std::move(*_moved_src);
- //delete _moved_src;
- } catch (...) { return false; }
- return true;
+ return new datastream_t(*self);
+ } catch (...) { return nullptr; }
}
uint8_t *datastream_data(datastream_t *self) { return self->data(); }