summaryrefslogtreecommitdiffstats
path: root/libopkg
diff options
context:
space:
mode:
authorgraham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2009-11-23 23:12:07 (EST)
committer graham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2009-11-23 23:12:07 (EST)
commitad0e06f0154e7217355c6480f3b117d474fd3f09 (patch)
treec942b9d4dc740d91f2f45a44e28789e210540c75 /libopkg
parent0673e730b861851f27505447862e942599d6705b (diff)
Remove useless memory allocation and strcpy.
git-svn-id: http://opkg.googlecode.com/svn/trunk@357 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
Diffstat (limited to 'libopkg')
-rw-r--r--libopkg/opkg_cmd.c6
1 files changed, 1 insertions, 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 {