Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-g2.git;a=commitdiff;h=1dd1d58b08c9da53b8ebcf55affeba391cd4f832

commit 1dd1d58b08c9da53b8ebcf55affeba391cd4f832
Author: Michel Hermier <[email protected]>
Date:   Tue May 13 22:49:44 2014 +0200

libpacman: Disable Object and Package copy constructor and operator.

diff --git a/lib/libpacman/object.h b/lib/libpacman/object.h
index 4852a5a..32038fd 100644
--- a/lib/libpacman/object.h
+++ b/lib/libpacman/object.h
@@ -47,6 +47,9 @@ private:
void operator delete[](void *ptr);
void *operator new[](std::size_t size);

+       Object(const libpacman::Object &other);
+       libpacman::Object &operator =(const libpacman::Object &other);
+
mutable unsigned m_reference_counter;
};

diff --git a/lib/libpacman/package.cpp b/lib/libpacman/package.cpp
index 4f8988a..8dbdeb0 100644
--- a/lib/libpacman/package.cpp
+++ b/lib/libpacman/package.cpp
@@ -67,46 +67,6 @@ Package::Package(const char *name, const char *version)
}
}

-Package::Package(const libpacman::Package &other)
-{
-       m_database     = other.m_database;
-
-       flags          = other.flags;
-       STRNCPY(m_name,      other.m_name,      PKG_NAME_LEN);
-       STRNCPY(m_version,   other.m_version,   PKG_VERSION_LEN);
-       STRNCPY(m_description, other.m_description, PKG_DESC_LEN);
-       STRNCPY(m_url,       other.m_url,       PKG_URL_LEN);
-       STRNCPY(builddate,   other.builddate,   PKG_DATE_LEN);
-       STRNCPY(buildtype,   other.buildtype,   PKG_DATE_LEN);
-       STRNCPY(installdate, other.installdate, PKG_DATE_LEN);
-       STRNCPY(packager,    other.packager,    PKG_PACKAGER_LEN);
-       STRNCPY(md5sum,      other.md5sum,      PKG_MD5SUM_LEN);
-       STRNCPY(sha1sum,     other.sha1sum,     PKG_SHA1SUM_LEN);
-       STRNCPY(arch,        other.arch,        PKG_ARCH_LEN);
-       size           = other.size;
-       usize          = other.usize;
-       m_force        = other.m_force;
-       m_stick        = other.m_stick;
-       scriptlet      = other.scriptlet;
-       m_reason       = other.m_reason;
-       license        = _pacman_list_strdup(other.license);
-       desc_localized = _pacman_list_strdup(other.desc_localized);
-       m_requiredby   = _pacman_list_strdup(other.m_requiredby);
-       m_conflicts    = _pacman_list_strdup(other.m_conflicts);
-       m_files        = _pacman_list_strdup(other.m_files);
-       m_backup       = _pacman_list_strdup(other.m_backup);
-       m_depends      = _pacman_list_strdup(other.m_depends);
-       m_removes      = _pacman_list_strdup(other.m_removes);
-       m_groups       = _pacman_list_strdup(other.m_groups);
-       m_provides     = _pacman_list_strdup(other.m_provides);
-       m_replaces     = _pacman_list_strdup(other.m_replaces);
-       triggers       = _pacman_list_strdup(other.triggers);
-
-       /* internal */
-       origin         = other.origin;
-       data           = (origin == PKG_FROM_FILE) ? strdup(other.data) : 
other.data;
-}
-
Package::~Package()
{
FREELIST(license);
@@ -126,11 +86,6 @@ Package::~Package()
}
}

-Package *Package::dup() const
-{
-       return new Package(*this);
-}
-
Database *Package::database() const
{
return m_database;
diff --git a/lib/libpacman/package.h b/lib/libpacman/package.h
index 523e90f..49ea2ed 100644
--- a/lib/libpacman/package.h
+++ b/lib/libpacman/package.h
@@ -95,11 +95,8 @@ public:                                                      
                  \
public:
Package(libpacman::Database *database = 0);
Package(const char *name, const char *version);
-       Package(const libpacman::Package &other);
virtual ~Package();

-       virtual libpacman::Package *dup() const;
-
libpacman::Database *database() const;

virtual int read(unsigned int flags);
@@ -115,6 +112,11 @@ public:
FStringList *provides() const;
bool provides(const char *pkgname);

+private:
+       Package(const libpacman::Package &other);
+       libpacman::Package &operator =(const libpacman::Package &other);
+
+public:
libpacman::Database *m_database;

unsigned int flags;
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to