Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-g2.git;a=commitdiff;h=8131ef1eb9cd5b5934c780472d9f2074ee496b5b
commit 8131ef1eb9cd5b5934c780472d9f2074ee496b5b Author: Michel Hermier <[email protected]> Date: Tue Oct 21 14:40:41 2014 +0200 libpacman: Make package_ptr refcounted. diff --git a/lib/libpacman/kernel/frefcounted.h b/lib/libpacman/kernel/frefcounted.h index 32147bb..6ab9f08 100644 --- a/lib/libpacman/kernel/frefcounted.h +++ b/lib/libpacman/kernel/frefcounted.h @@ -90,18 +90,40 @@ namespace flib : refcounted_ptr(o.m_refcounted_ptr) { } + refcounted_ptr(const refcounted_ptr &o) + : refcounted_ptr(o.m_refcounted_ptr) + { } + + refcounted_ptr(refcounted_ptr &&o) + : refcounted_ptr() + { + swap(o); + } + ~refcounted_ptr() { reset(); } template <class Y> - refcounted_ptr<T> &operator = (const refcounted_ptr<Y> &o) + refcounted_ptr &operator = (const refcounted_ptr<Y> &o) + { + reset(o.m_refcounted_ptr); + return *this; + } + + refcounted_ptr &operator = (const refcounted_ptr &o) { reset(o.m_refcounted_ptr); return *this; } + refcounted_ptr &operator = (refcounted_ptr &&o) + { + swap(o); + return *this; + } + /* Manipulators */ void reset() { diff --git a/lib/libpacman/package.h b/lib/libpacman/package.h index 38612c6..6524fd8 100644 --- a/lib/libpacman/package.h +++ b/lib/libpacman/package.h @@ -177,11 +177,7 @@ public: char *m_path; }; - #if 0 typedef flib::refcounted_ptr<package> package_ptr; - #else - typedef package *package_ptr; - #endif template <class T> struct less; _______________________________________________ Frugalware-git mailing list [email protected] http://frugalware.org/mailman/listinfo/frugalware-git
