Removed a bunch of if(0) and dead code
authorpixdamix <pixdamix@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Thu, 5 Nov 2009 08:46:43 +0000 (08:46 +0000)
committerpixdamix <pixdamix@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Thu, 5 Nov 2009 08:46:43 +0000 (08:46 +0000)
Applied this semantic patch:

  @@
  statement S;
  @@
  - if(0) S

  @@
  @@
  - remove_obsolete_maintainer_scripts(...) {
  - ...
  -}

  @@
  @@
  - remove_obsolete_maintainer_scripts(...);

  @@
  identifier i;
  @@
  -if(i){
  -}

git-svn-id: http://opkg.googlecode.com/svn/trunk@262 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

libopkg/hash_table.c
libopkg/opkg_cmd.c
libopkg/opkg_install.c
libopkg/pkg.c

index df6ff4f024b313ba48128938771f4435ecf852ae..9e42da07a936220dcae41ad1593a32af78a6a9d3 100644 (file)
@@ -123,11 +123,9 @@ int hash_table_insert(hash_table_t *hash, const char *key, void *value)
 {
      int ndx= hash_index(hash, key);
      hash_entry_t *hash_entry = hash->entries + ndx;
 {
      int ndx= hash_index(hash, key);
      hash_entry_t *hash_entry = hash->entries + ndx;
-     if (0) opkg_message(NULL, OPKG_DEBUG2, "Function: %s. Inserting in hash for '%s' \n", __FUNCTION__, key);
      if (hash_entry->key) {
          if (strcmp(hash_entry->key, key) == 0) {
               /* alread in table, update the value */
      if (hash_entry->key) {
          if (strcmp(hash_entry->key, key) == 0) {
               /* alread in table, update the value */
-               if (0) opkg_message(NULL, OPKG_DEBUG2, "Function: %s. Value already in hash for '%s' \n", __FUNCTION__, key);
               hash_entry->data = value;
               return 0;
          } else {
               hash_entry->data = value;
               return 0;
          } else {
@@ -136,7 +134,6 @@ int hash_table_insert(hash_table_t *hash, const char *key, void *value)
                * then add a new entry
                * before we can hook up the value
                */
                * then add a new entry
                * before we can hook up the value
                */
-               if (0) opkg_message(NULL, OPKG_DEBUG2, "Function: %s. Value already in hash by collision for '%s' \n", __FUNCTION__, key);
               while (hash_entry->next) {
                    hash_entry = hash_entry->next;
                     if (strcmp(hash_entry->key, key) == 0) {
               while (hash_entry->next) {
                    hash_entry = hash_entry->next;
                     if (strcmp(hash_entry->key, key) == 0) {
index 807777e56870f0ef7542bc56983d737f51ec5b8d..2dd17b2a03ef1d02dc26be2957cbebb3ee658193 100644 (file)
@@ -568,9 +568,6 @@ static int opkg_install_cmd(opkg_conf_t *conf, int argc, char **argv)
          }
      }
 
          }
      }
 
-     /* recheck to verify that all dependences are satisfied */
-     if (0) opkg_satisfy_all_dependences(conf);
-
      opkg_configure_packages(conf, NULL);
 
      write_status_files_if_changed(conf);
      opkg_configure_packages(conf, NULL);
 
      write_status_files_if_changed(conf);
@@ -632,9 +629,6 @@ static int opkg_upgrade_cmd(opkg_conf_t *conf, int argc, char **argv)
          pkg_vec_free(installed);
      }
 
          pkg_vec_free(installed);
      }
 
-     /* recheck to verify that all dependences are satisfied */
-     if (0) opkg_satisfy_all_dependences(conf);
-
      opkg_configure_packages(conf, NULL);
 
      write_status_files_if_changed(conf);
      opkg_configure_packages(conf, NULL);
 
      write_status_files_if_changed(conf);
index 61563d6756cfa175b9c61e5d499454a2d2c3591f..a67129e5fb2bdf49fa8c21db963bba8e83fcaeb3 100644 (file)
@@ -1470,42 +1470,11 @@ static int remove_obsolesced_files(opkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg
      return 0;
 }
 
      return 0;
 }
 
-static int remove_obsolete_maintainer_scripts(opkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg)
-{
-     int i;
-     int err = 0;
-     char *globpattern;
-     glob_t globbuf;
-     if (0) {
-         if (!pkg->dest) {
-              opkg_message(conf, OPKG_ERROR, "%s: no dest for package %s\n", __FUNCTION__, pkg->name);
-              return -1;
-         }
-         sprintf_alloc(&globpattern, "%s/%s.*", pkg->dest->info_dir, pkg->name);
-         err = glob(globpattern, 0, NULL, &globbuf);
-         free(globpattern);
-         if (err) {
-              return err;
-         }
-         /* XXXX this should perhaps only remove the ones that are not overwritten in new package.  Jamey 11/11/2003 */
-         for (i = 0; i < globbuf.gl_pathc; i++) {
-              opkg_message(conf, OPKG_DEBUG, "Removing control file %s from old_pkg %s\n",
-                           globbuf.gl_pathv[i], old_pkg->name);
-              if (!conf->noaction)
-                   unlink(globbuf.gl_pathv[i]);
-         }
-         globfree(&globbuf);
-     }
-     return err;
-}
-
 static int install_maintainer_scripts(opkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg)
 {
      int ret;
      char *prefix;
 
 static int install_maintainer_scripts(opkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg)
 {
      int ret;
      char *prefix;
 
-     if (old_pkg)
-         remove_obsolete_maintainer_scripts(conf, pkg, old_pkg);
      sprintf_alloc(&prefix, "%s.", pkg->name);
      ret = pkg_extract_control_files_to_dir_with_prefix(pkg,
                                                        pkg->dest->info_dir,
      sprintf_alloc(&prefix, "%s.", pkg->name);
      ret = pkg_extract_control_files_to_dir_with_prefix(pkg,
                                                        pkg->dest->info_dir,
index 48169ea7ad6c22100bd0e15ab85a7e6a460eb317..dc001863078e41f4edd7c51cceb5a59689d94e0d 100644 (file)
@@ -410,9 +410,6 @@ int pkg_merge(pkg_t *oldpkg, pkg_t *newpkg, int set_status)
 
      if (!oldpkg->filename)
          oldpkg->filename = xstrdup(newpkg->filename);
 
      if (!oldpkg->filename)
          oldpkg->filename = xstrdup(newpkg->filename);
-     if (0)
-     fprintf(stdout, "pkg=%s old local_filename=%s new local_filename=%s\n", 
-            oldpkg->name, oldpkg->local_filename, newpkg->local_filename);
      if (!oldpkg->local_filename)
          oldpkg->local_filename = xstrdup(newpkg->local_filename);
      if (!oldpkg->tmp_unpack_dir)
      if (!oldpkg->local_filename)
          oldpkg->local_filename = xstrdup(newpkg->local_filename);
      if (!oldpkg->tmp_unpack_dir)