bin/xbps-rindex/index-add.c: remove unused variable.

This commit is contained in:
Juan RP 2013-04-04 10:04:45 +02:00
parent 1741019b90
commit 6ac76f68ed

View File

@ -99,9 +99,6 @@ index_add(struct xbps_handle *xhp, int argc, char **argv)
* Process all packages specified in argv. * Process all packages specified in argv.
*/ */
for (i = 0; i < argc; i++) { for (i = 0; i < argc; i++) {
if ((tmpfilen = strdup(argv[i])) == NULL)
return ENOMEM;
/* /*
* Read metadata props plist dictionary from binary package. * Read metadata props plist dictionary from binary package.
*/ */
@ -110,7 +107,6 @@ index_add(struct xbps_handle *xhp, int argc, char **argv)
if (newpkgd == NULL) { if (newpkgd == NULL) {
fprintf(stderr, "failed to read %s metadata for `%s'," fprintf(stderr, "failed to read %s metadata for `%s',"
" skipping!\n", XBPS_PKGPROPS, argv[i]); " skipping!\n", XBPS_PKGPROPS, argv[i]);
free(tmpfilen);
continue; continue;
} }
prop_dictionary_get_cstring_nocopy(newpkgd, "architecture", prop_dictionary_get_cstring_nocopy(newpkgd, "architecture",
@ -133,7 +129,6 @@ index_add(struct xbps_handle *xhp, int argc, char **argv)
curpkgd = prop_dictionary_get(idx, pkgname); curpkgd = prop_dictionary_get(idx, pkgname);
if (curpkgd == NULL) { if (curpkgd == NULL) {
if (errno && errno != ENOENT) { if (errno && errno != ENOENT) {
free(tmpfilen);
free(pkgver); free(pkgver);
free(pkgname); free(pkgname);
return errno; return errno;
@ -150,7 +145,6 @@ index_add(struct xbps_handle *xhp, int argc, char **argv)
"(%s), already registered.\n", "(%s), already registered.\n",
pkgver, arch); pkgver, arch);
prop_object_release(newpkgd); prop_object_release(newpkgd);
free(tmpfilen);
free(pkgver); free(pkgver);
free(pkgname); free(pkgname);
continue; continue;
@ -169,14 +163,12 @@ index_add(struct xbps_handle *xhp, int argc, char **argv)
* objects for the index. * objects for the index.
*/ */
if ((sha256 = xbps_file_hash(argv[i])) == NULL) { if ((sha256 = xbps_file_hash(argv[i])) == NULL) {
free(tmpfilen);
free(pkgver); free(pkgver);
free(pkgname); free(pkgname);
return errno; return errno;
} }
if (!prop_dictionary_set_cstring(newpkgd, "filename-sha256", if (!prop_dictionary_set_cstring(newpkgd, "filename-sha256",
sha256)) { sha256)) {
free(tmpfilen);
free(pkgver); free(pkgver);
free(pkgname); free(pkgname);
return errno; return errno;
@ -184,7 +176,6 @@ index_add(struct xbps_handle *xhp, int argc, char **argv)
free(sha256); free(sha256);
if (stat(argv[i], &st) == -1) { if (stat(argv[i], &st) == -1) {
free(tmpfilen);
free(pkgver); free(pkgver);
free(pkgname); free(pkgname);
return errno; return errno;
@ -192,7 +183,6 @@ index_add(struct xbps_handle *xhp, int argc, char **argv)
if (!prop_dictionary_set_uint64(newpkgd, "filename-size", if (!prop_dictionary_set_uint64(newpkgd, "filename-size",
(uint64_t)st.st_size)) { (uint64_t)st.st_size)) {
free(tmpfilen);
free(pkgver); free(pkgver);
free(pkgname); free(pkgname);
return errno; return errno;
@ -217,14 +207,12 @@ index_add(struct xbps_handle *xhp, int argc, char **argv)
* Add new pkg dictionary into the index. * Add new pkg dictionary into the index.
*/ */
if (!prop_dictionary_set(idx, pkgname, newpkgd)) { if (!prop_dictionary_set(idx, pkgname, newpkgd)) {
free(tmpfilen);
free(pkgname); free(pkgname);
return EINVAL; return EINVAL;
} }
flush = true; flush = true;
printf("index: added `%s' (%s).\n", pkgver, arch); printf("index: added `%s' (%s).\n", pkgver, arch);
free(tmpfilen);
/* /*
* Add new pkg dictionary into the index-files. * Add new pkg dictionary into the index-files.
*/ */