This is an automated email from the git hooks/post-receive script. guillem pushed a commit to branch main in repository dpkg.
View the commit online: https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=73f77c972f5709bbccdf8fba137f021b7ce09bf2 commit 73f77c972f5709bbccdf8fba137f021b7ce09bf2 Author: Guillem Jover <[email protected]> AuthorDate: Sun Aug 11 05:00:25 2024 +0200 libdpkg: Add new varbuf C++ move constructors --- lib/dpkg/varbuf.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/dpkg/varbuf.h b/lib/dpkg/varbuf.h index 65355a7ba..5b0e259f0 100644 --- a/lib/dpkg/varbuf.h +++ b/lib/dpkg/varbuf.h @@ -61,6 +61,7 @@ struct varbuf { explicit varbuf(size_t _size = 0); explicit varbuf(const char *str); varbuf(const varbuf &v); + varbuf(varbuf &&v); ~varbuf(); void init(size_t _size = 0); @@ -101,6 +102,7 @@ struct varbuf { void trim_prefix(int prefix); varbuf &operator=(const varbuf &v); + varbuf &operator=(varbuf &&v); varbuf &operator+=(const varbuf &v); varbuf &operator+=(int c); varbuf &operator+=(const char *str); @@ -199,6 +201,13 @@ varbuf::varbuf(const varbuf &v) varbuf_set_buf(this, v.buf, v.used); } +inline +varbuf::varbuf(varbuf &&v): + varbuf() +{ + varbuf_swap(this, &v); +} + inline varbuf::~varbuf() { @@ -384,6 +393,14 @@ varbuf::operator=(const varbuf &v) return *this; } +inline varbuf & +varbuf::operator=(varbuf &&v) +{ + varbuf_swap(this, &v); + + return *this; +} + inline varbuf & varbuf::operator+=(const varbuf &v) { -- Dpkg.Org's dpkg

