Remove unused parameter from pkg_hash_fetch_best_installation_candidate().
[oweals/opkg-lede.git] / libopkg / opkg.c
index 437beb1b8890117ee6c01602ada33f4efbe86b6b..51989f7f16df06a89e36501c6e5fdd92caa5f544 100644 (file)
@@ -411,7 +411,7 @@ opkg_install_package (opkg_t *opkg, const char *package_name, opkg_progress_call
     return OPKG_PACKAGE_ALREADY_INSTALLED;
   }
 
-  new = pkg_hash_fetch_best_installation_candidate_by_name(opkg->conf, package_name, NULL);
+  new = pkg_hash_fetch_best_installation_candidate_by_name(opkg->conf, package_name);
   if (!new)
   {
     /* XXX: Error: Could not find package to install */
@@ -513,18 +513,7 @@ opkg_install_package (opkg_t *opkg, const char *package_name, opkg_progress_call
   if (err)
   {
     opkg_package_free (pdata.package);
-    switch (err)
-    {
-      case OPKG_INSTALL_ERR_NOT_TRUSTED: return OPKG_GPG_ERROR;
-      case OPKG_INSTALL_ERR_DOWNLOAD: return OPKG_DOWNLOAD_FAILED;
-      case OPKG_INSTALL_ERR_DEPENDENCIES:
-      case OPKG_INSTALL_ERR_CONFLICTS: return OPKG_DEPENDENCIES_FAILED;
-      case OPKG_INSTALL_ERR_ALREADY_INSTALLED: return OPKG_PACKAGE_ALREADY_INSTALLED;
-      case OPKG_INSTALL_ERR_SIGNATURE: return OPKG_GPG_ERROR;
-      case OPKG_INSTALL_ERR_MD5: return OPKG_MD5_ERROR;
-      case OPKG_INSTALL_ERR_SHA256: return OPKG_SHA256_ERROR;
-      default: return OPKG_UNKNOWN_ERROR;
-    }
+    return OPKG_UNKNOWN_ERROR;
   }
 
   progress (pdata, 75);
@@ -651,20 +640,8 @@ opkg_upgrade_package (opkg_t *opkg, const char *package_name, opkg_progress_call
   /* opkg_upgrade_pkg returns the error codes of opkg_install_pkg */
   if (err)
   {
-
     opkg_package_free (pdata.package);
-    switch (err)
-    {
-      case OPKG_INSTALL_ERR_NOT_TRUSTED: return OPKG_GPG_ERROR;
-      case OPKG_INSTALL_ERR_DOWNLOAD: return OPKG_DOWNLOAD_FAILED;
-      case OPKG_INSTALL_ERR_DEPENDENCIES:
-      case OPKG_INSTALL_ERR_CONFLICTS: return OPKG_DEPENDENCIES_FAILED;
-      case OPKG_INSTALL_ERR_ALREADY_INSTALLED: return OPKG_PACKAGE_ALREADY_INSTALLED;
-      case OPKG_INSTALL_ERR_SIGNATURE: return OPKG_GPG_ERROR;
-      case OPKG_INSTALL_ERR_MD5: return OPKG_MD5_ERROR;
-      case OPKG_INSTALL_ERR_SHA256: return OPKG_SHA256_ERROR;
-      default: return OPKG_UNKNOWN_ERROR;
-    }
+    return OPKG_UNKNOWN_ERROR;
   }
   progress (pdata, 75);
 
@@ -947,7 +924,9 @@ opkg_list_upgradable_packages (opkg_t *opkg, opkg_package_callback_t callback, v
     head  =  prepare_upgrade_list(opkg->conf);
     for (node=active_list_next(head, head); node; active_list_next(head,node)) {
         old = list_entry(node, pkg_t, list);
-        new = pkg_hash_fetch_best_installation_candidate_by_name(opkg->conf, old->name, NULL);
+        new = pkg_hash_fetch_best_installation_candidate_by_name(opkg->conf, old->name);
+       if (new == NULL)
+               continue;
         package = pkg_t_to_opkg_package_t (new);
         callback (opkg, package, user_data);
         opkg_package_free (package);