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=19777c0f7fe274e7fdee3da7e428b63e3465dbc3

commit 19777c0f7fe274e7fdee3da7e428b63e3465dbc3
Author: Guillem Jover <[email protected]>
AuthorDate: Tue Jul 23 15:01:49 2024 +0200

    libdpkg: Add new varbuf C++ copy constructors
---
 lib/dpkg/varbuf.h | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/lib/dpkg/varbuf.h b/lib/dpkg/varbuf.h
index bedd60443..65355a7ba 100644
--- a/lib/dpkg/varbuf.h
+++ b/lib/dpkg/varbuf.h
@@ -60,6 +60,7 @@ struct varbuf {
 #ifdef __cplusplus
        explicit varbuf(size_t _size = 0);
        explicit varbuf(const char *str);
+       varbuf(const varbuf &v);
        ~varbuf();
 
        void init(size_t _size = 0);
@@ -99,6 +100,7 @@ struct varbuf {
        void trim_prefix(varbuf &prefix);
        void trim_prefix(int prefix);
 
+       varbuf &operator=(const varbuf &v);
        varbuf &operator+=(const varbuf &v);
        varbuf &operator+=(int c);
        varbuf &operator+=(const char *str);
@@ -190,6 +192,13 @@ varbuf::varbuf(const char *str)
        varbuf_set_str(this, str);
 }
 
+inline
+varbuf::varbuf(const varbuf &v)
+{
+       varbuf_init(this, v.used);
+       varbuf_set_buf(this, v.buf, v.used);
+}
+
 inline
 varbuf::~varbuf()
 {
@@ -366,6 +375,15 @@ varbuf::trim_prefix(int prefix)
        varbuf_trim_char_prefix(this, prefix);
 }
 
+inline varbuf &
+varbuf::operator=(const varbuf &v)
+{
+       varbuf_init(this, v.used);
+       varbuf_set_buf(this, v.buf, v.used);
+
+       return *this;
+}
+
 inline varbuf &
 varbuf::operator+=(const varbuf &v)
 {

-- 
Dpkg.Org's dpkg

Reply via email to