[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/sysadmin/libqapt/src
From:       Jonathan Michael Thomas <echidnaman () kubuntu ! org>
Date:       2010-10-31 22:17:41
Message-ID: 20101031221741.2F0BAAC89B () svn ! kde ! org
[Download RAW message or body]

SVN commit 1191692 by jmthomas:

These two if statements both result in doing the same thing, so use an || to evaluate \
both with less code.


 M  +1 -6      backend.cpp  
 M  +2 -10     worker/worker.cpp  


--- trunk/extragear/sysadmin/libqapt/src/backend.cpp #1191691:1191692
@@ -134,16 +134,11 @@
 bool Backend::init()
 {
     Q_D(Backend);
-    if (!pkgInitConfig(*_config)) {
+    if (!pkgInitConfig(*_config) || !pkgInitSystem(*_config, _system)) {
         throwInitError();
         return false;
     }
 
-    if (!pkgInitSystem(*_config, _system)) {
-        throwInitError();
-        return false;
-    }
-
     d->cache = new Cache(this);
     d->config = new Config(this);
     reloadCache();
--- trunk/extragear/sysadmin/libqapt/src/worker/worker.cpp #1191691:1191692
@@ -31,7 +31,6 @@
 #include <apt-pkg/algorithms.h>
 #include <apt-pkg/acquire-item.h>
 #include <apt-pkg/configuration.h>
-#include <apt-pkg/depcache.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/init.h>
@@ -117,16 +116,11 @@
 
 bool QAptWorker::initializeApt()
 {
-    if (!pkgInitConfig(*_config)) {
+    if (!pkgInitConfig(*_config) || !pkgInitSystem(*_config, _system)) {
         throwInitError();
         return false;
     }
 
-    if (!pkgInitSystem(*_config, _system)) {
-        throwInitError();
-        return false;
-    }
-
     delete m_cache;
     m_cache = new QApt::Cache(this);
     if (!m_cache->open()) {
@@ -134,10 +128,8 @@
         return false;
     }
 
-    pkgDepCache *depCache = m_cache->depCache();
-
     delete m_records;
-    m_records = new pkgRecords(*depCache);
+    m_records = new pkgRecords(*m_cache->depCache());
 
     return true;
 }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic