From ad0e06f0154e7217355c6480f3b117d474fd3f09 Mon Sep 17 00:00:00 2001 From: "graham.gower" Date: Tue, 24 Nov 2009 04:12:07 +0000 Subject: [PATCH] Remove useless memory allocation and strcpy. git-svn-id: http://opkg.googlecode.com/svn/trunk@357 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358 --- libopkg/opkg_cmd.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/libopkg/opkg_cmd.c b/libopkg/opkg_cmd.c index a90c6a9..de2e6ca 100644 --- a/libopkg/opkg_cmd.c +++ b/libopkg/opkg_cmd.c @@ -849,7 +849,6 @@ static int opkg_remove_cmd(opkg_conf_t *conf, int argc, char **argv) pkg_t *pkg; pkg_t *pkg_to_remove; pkg_vec_t *available; - char *pkg_name = NULL; global_conf = conf; signal(SIGINT, sigint_handler); @@ -862,11 +861,9 @@ static int opkg_remove_cmd(opkg_conf_t *conf, int argc, char **argv) available = pkg_vec_alloc(); pkg_hash_fetch_all_installed(&conf->pkg_hash, available); for (i=0; i < argc; i++) { - pkg_name = xcalloc(1, strlen(argv[i])+2); - strcpy(pkg_name,argv[i]); for (a=0; a < available->len; a++) { pkg = available->pkgs[a]; - if (pkg_name && fnmatch(pkg_name, pkg->name, 0)) { + if (fnmatch(argv[i], pkg->name, 0)) { continue; } if (conf->restrict_to_default_dest) { @@ -888,7 +885,6 @@ static int opkg_remove_cmd(opkg_conf_t *conf, int argc, char **argv) opkg_remove_pkg(conf, pkg_to_remove,0); done = 1; } - free (pkg_name); } pkg_vec_free(available); } else { -- 2.25.1