aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/salticidae/buffer.h6
-rw-r--r--include/salticidae/conn.h2
-rw-r--r--include/salticidae/crypto.h10
-rw-r--r--include/salticidae/msg.h6
-rw-r--r--include/salticidae/netaddr.h2
-rw-r--r--include/salticidae/network.h2
-rw-r--r--include/salticidae/ref.h6
-rw-r--r--include/salticidae/stream.h10
8 files changed, 22 insertions, 22 deletions
diff --git a/include/salticidae/buffer.h b/include/salticidae/buffer.h
index 35d10b8..6d3f97a 100644
--- a/include/salticidae/buffer.h
+++ b/include/salticidae/buffer.h
@@ -87,7 +87,7 @@ class SegBuffer {
auto res = std::move(buffer.front().data);
buffer.pop_front();
_size -= res.size();
- return std::move(res);
+ return res;
}
bytearray_t pop(size_t len) {
@@ -104,7 +104,7 @@ class SegBuffer {
}
buffer.erase(buffer.begin(), i);
_size -= res.size();
- return std::move(res);
+ return res;
}
size_t size() const { return _size; }
@@ -140,7 +140,7 @@ struct MPSCWriteBuffer {
bytearray_t move_pop() {
buffer_entry_t res;
buffer.try_dequeue(res);
- return std::move(res.data);
+ return res.data;
}
queue_t &get_queue() { return buffer; }
diff --git a/include/salticidae/conn.h b/include/salticidae/conn.h
index a594da6..e20a03c 100644
--- a/include/salticidae/conn.h
+++ b/include/salticidae/conn.h
@@ -563,7 +563,7 @@ class ConnPool {
conn = _connect(addr);
h.set_result(conn);
}).get()));
- return std::move(ret);
+ return ret;
}
/** Actively connect to remote addr (async). */
diff --git a/include/salticidae/crypto.h b/include/salticidae/crypto.h
index fe4de4f..65acc2d 100644
--- a/include/salticidae/crypto.h
+++ b/include/salticidae/crypto.h
@@ -73,7 +73,7 @@ class SHA256 {
bytearray_t digest() {
bytearray_t md(32);
_digest(md);
- return std::move(md);
+ return md;
}
};
@@ -115,7 +115,7 @@ class SHA1 {
bytearray_t digest() {
bytearray_t md(32);
_digest(md);
- return std::move(md);
+ return md;
}
};
@@ -200,7 +200,7 @@ class PKey {
bytearray_t res(der, der + ret);
OPENSSL_cleanse(der, ret);
OPENSSL_free(der);
- return std::move(res);
+ return res;
}
bytearray_t get_privkey_der() const {
@@ -211,7 +211,7 @@ class PKey {
bytearray_t res(der, der + ret);
OPENSSL_cleanse(der, ret);
OPENSSL_free(der);
- return std::move(res);
+ return res;
}
void save_privkey_to_file(const std::string &fname) {
@@ -295,7 +295,7 @@ class X509 {
bytearray_t res(der, der + ret);
OPENSSL_cleanse(der, ret);
OPENSSL_free(der);
- return std::move(res);
+ return res;
}
void save_to_file(const std::string &fname) {
diff --git a/include/salticidae/msg.h b/include/salticidae/msg.h
index 670d942..a81a5ae 100644
--- a/include/salticidae/msg.h
+++ b/include/salticidae/msg.h
@@ -172,7 +172,7 @@ class MsgBase {
throw std::runtime_error("payload not available");
no_payload = true;
#endif
- return std::move(payload);
+ return DataStream(std::move(payload));
}
void set_payload(DataStream &&s) {
@@ -203,7 +203,7 @@ class MsgBase {
<< "checksum=" << get_hex(checksum) << " "
#endif
<< "payload=" << get_hex(payload) << ">";
- return std::move(s);
+ return std::string(std::move(s));
}
#ifndef SALTICIDAE_NOCHECKSUM
@@ -239,7 +239,7 @@ class MsgBase {
<< htole(checksum)
#endif
<< payload;
- return std::move(s);
+ return bytearray_t(std::move(s));
}
void gen_hash_list(DataStream &s,
diff --git a/include/salticidae/netaddr.h b/include/salticidae/netaddr.h
index 7d04d43..669ff27 100644
--- a/include/salticidae/netaddr.h
+++ b/include/salticidae/netaddr.h
@@ -96,7 +96,7 @@ struct NetAddr {
DataStream s;
s << "<NetAddr " << std::string(inet_ntoa(in))
<< ":" << std::to_string(ntohs(port)) << ">";
- return std::move(s);
+ return std::string(std::move(s));
}
bool is_null() const { return ip == 0 && port == 0; }
diff --git a/include/salticidae/network.h b/include/salticidae/network.h
index c3b9e79..48b555f 100644
--- a/include/salticidae/network.h
+++ b/include/salticidae/network.h
@@ -1099,7 +1099,7 @@ PeerNetwork<O, _, __>::get_peer_conn(const NetAddr &addr) const {
}
h.set_result(std::move(conn));
}).get()));
- return std::move(ret);
+ return ret;
}
template<typename O, O _, O __>
diff --git a/include/salticidae/ref.h b/include/salticidae/ref.h
index bb8efc0..bb5fb3a 100644
--- a/include/salticidae/ref.h
+++ b/include/salticidae/ref.h
@@ -151,7 +151,7 @@ template<typename T, typename D = default_delete<T>, typename T_, typename D_>
BoxObj<T, D> static_pointer_cast(BoxObj<T_, D_> &&other) {
BoxObj<T, D> box{};
box.obj = static_cast<typename BoxObj<T, D>::type *>(other.obj);
- return std::move(box);
+ return box;
}
struct _RCCtl {
@@ -447,7 +447,7 @@ RcObjBase<T, R_, D> static_pointer_cast(const RcObjBase<T_, R_, D_> &other) {
rc.obj = static_cast<typename RcObjBase<T, R_, D>::type *>(other.obj);
if ((rc.ctl = other.ctl))
rc.ctl->add_ref();
- return std::move(rc);
+ return rc;
}
template<typename T, typename D = default_delete<T>,
@@ -457,7 +457,7 @@ RcObjBase<T, R_, D> static_pointer_cast(RcObjBase<T_, R_, D_> &&other) {
rc.obj = static_cast<typename RcObjBase<T, R_, D>::type *>(other.obj);
rc.ctl = other.ctl;
other.ctl = nullptr;
- return std::move(rc);
+ return rc;
}
template<typename T, typename R>
diff --git a/include/salticidae/stream.h b/include/salticidae/stream.h
index 251e3f7..fb951cb 100644
--- a/include/salticidae/stream.h
+++ b/include/salticidae/stream.h
@@ -188,7 +188,7 @@ class DataStream {
}
operator bytearray_t () && {
- return std::move(buffer);
+ return buffer;
}
operator std::string () const & {
@@ -224,7 +224,7 @@ class Serializable {
bytearray_t to_bytes() const {
DataStream s;
s << *this;
- return std::move(s);
+ return bytearray_t(std::move(s));
}
inline std::string to_hex() const;
@@ -310,7 +310,7 @@ class Blob: public Serializable {
operator bytearray_t () const & {
DataStream s;
s << *this;
- return std::move(s);
+ return bytearray_t(std::move(s));
}
};
@@ -393,7 +393,7 @@ class _Bits {
operator bytearray_t () const & {
DataStream s;
s << *this;
- return std::move(s);
+ return bytearray_t(std::move(s));
}
uint8_t get(uint32_t idx) const {
@@ -453,7 +453,7 @@ template<typename T> inline std::string get_hex(const T &x) {
inline bytearray_t from_hex(const std::string &hex_str) {
DataStream s;
s.load_hex(hex_str);
- return std::move(s);
+ return bytearray_t(std::move(s));
}
inline std::string Serializable::to_hex() const { return get_hex(*this); }