Use C99 for loop initializers.

That means that a C99 compiler is now mandatory.
This commit is contained in:
Juan RP
2013-09-15 10:06:49 +02:00
parent 9a9c816552
commit 4057e4961c
32 changed files with 105 additions and 138 deletions

View File

@@ -163,7 +163,6 @@ entry_is_conf_file(const char *file)
{
xbps_array_t a;
const char *curfile;
unsigned int i;
assert(file);
@@ -171,7 +170,7 @@ entry_is_conf_file(const char *file)
if (a == NULL || xbps_array_count(a) == 0)
return false;
for (i = 0; i < xbps_array_count(a); i++) {
for (unsigned int i = 0; i < xbps_array_count(a); i++) {
xbps_array_get_cstring_nocopy(a, i, &curfile);
if (strcmp(file, curfile) == 0)
return true;

View File

@@ -144,7 +144,6 @@ generate_conf_file(void)
{
xbps_dictionary_t d, d2;
struct defprops *dfp;
size_t i;
const char *outfile = "xbps-dgraph.conf";
d = xbps_dictionary_create();
@@ -165,7 +164,7 @@ generate_conf_file(void)
xbps_dictionary_set(d, "node-sub", d2);
xbps_object_release(d2);
for (i = 0; i < __arraycount(dfprops); i++) {
for (unsigned int i = 0; i < __arraycount(dfprops); i++) {
dfp = &dfprops[i];
d2 = xbps_dictionary_get(d, dfp->sect);
xbps_dictionary_set_cstring_nocopy(d2, dfp->prop, dfp->val);
@@ -187,14 +186,13 @@ write_conf_property_on_stream(FILE *f,
xbps_array_t allkeys, allkeys2;
xbps_dictionary_keysym_t dksym, dksym2;
xbps_object_t keyobj, keyobj2;
size_t i, x;
const char *cf_val, *keyname, *keyname2;
/*
* Iterate over the main dictionary.
*/
allkeys = xbps_dictionary_all_keys(confd);
for (i = 0; i < xbps_array_count(allkeys); i++) {
for (unsigned int i = 0; i < xbps_array_count(allkeys); i++) {
dksym = xbps_array_get(allkeys, i);
keyname = xbps_dictionary_keysym_cstring_nocopy(dksym);
keyobj = xbps_dictionary_get_keysym(confd, dksym);
@@ -205,7 +203,7 @@ write_conf_property_on_stream(FILE *f,
* Iterate over the dictionary sections [edge/graph/node].
*/
allkeys2 = xbps_dictionary_all_keys(keyobj);
for (x = 0; x < xbps_array_count(allkeys2); x++) {
for (unsigned int x = 0; x < xbps_array_count(allkeys2); x++) {
dksym2 = xbps_array_get(allkeys2, x);
keyname2 = xbps_dictionary_keysym_cstring_nocopy(dksym2);
keyobj2 = xbps_dictionary_get_keysym(keyobj, dksym2);
@@ -244,11 +242,10 @@ parse_array_in_pkg_dictionary(FILE *f, xbps_dictionary_t plistd,
{
xbps_dictionary_keysym_t dksym;
xbps_object_t keyobj, sub_keyobj;
unsigned int i, x;
const char *tmpkeyname, *cfprop, *optnodetmp;
char *optnode, *keyname;
for (i = 0; i < xbps_array_count(allkeys); i++) {
for (unsigned int i = 0; i < xbps_array_count(allkeys); i++) {
dksym = xbps_array_get(allkeys, i);
tmpkeyname = xbps_dictionary_keysym_cstring_nocopy(dksym);
/* Ignore these objects */
@@ -268,7 +265,7 @@ parse_array_in_pkg_dictionary(FILE *f, xbps_dictionary_t plistd,
xbps_dictionary_get_cstring_nocopy(sub_confd, "opt-style", &cfprop);
/* Check if object is optional and fill it in */
for (x = 0; x < __arraycount(optional_objs); x++) {
for (unsigned int x = 0; x < __arraycount(optional_objs); x++) {
if (strcmp(keyname, optional_objs[x]) == 0) {
optnode = xbps_xasprintf("[style=\"%s\"",
cfprop);
@@ -286,7 +283,7 @@ parse_array_in_pkg_dictionary(FILE *f, xbps_dictionary_t plistd,
fprintf(f, " %s %s];\n", keyname,
optnodetmp);
for (x = 0; x < xbps_array_count(keyobj); x++) {
for (unsigned int x = 0; x < xbps_array_count(keyobj); x++) {
sub_keyobj = xbps_array_get(keyobj, x);
if (xbps_object_type(sub_keyobj) == XBPS_TYPE_STRING) {
/*

View File

@@ -48,10 +48,9 @@ struct transaction {
static void
show_missing_deps(xbps_array_t a)
{
unsigned int i;
const char *str;
for (i = 0; i < xbps_array_count(a); i++) {
for (unsigned int i = 0; i < xbps_array_count(a); i++) {
xbps_array_get_cstring_nocopy(a, i, &str);
fprintf(stderr, "%s\n", str);
}
@@ -60,10 +59,9 @@ show_missing_deps(xbps_array_t a)
static void
show_conflicts(xbps_array_t a)
{
unsigned int i;
const char *str;
for (i = 0; i < xbps_array_count(a); i++) {
for (unsigned int i = 0; i < xbps_array_count(a); i++) {
xbps_array_get_cstring_nocopy(a, i, &str);
fprintf(stderr, "%s\n", str);
}

View File

@@ -49,7 +49,6 @@ check_pkg_rundeps(struct xbps_handle *xhp, const char *pkgname, void *arg)
{
xbps_dictionary_t pkg_propsd = arg;
xbps_array_t array;
unsigned int i;
const char *reqpkg;
bool test_broken = false;
@@ -57,7 +56,7 @@ check_pkg_rundeps(struct xbps_handle *xhp, const char *pkgname, void *arg)
return 0;
array = xbps_dictionary_get(pkg_propsd, "run_depends");
for (i = 0; i < xbps_array_count(array); i++) {
for (unsigned int i = 0; i < xbps_array_count(array); i++) {
xbps_array_get_cstring_nocopy(array, i, &reqpkg);
if (xbps_pkg_is_installed(xhp, reqpkg) <= 0) {
xbps_error_printf("%s: dependency not satisfied: %s\n",

View File

@@ -77,7 +77,6 @@ check_pkg_symlinks(struct xbps_handle *xhp, const char *pkgname, void *arg)
xbps_array_t array;
xbps_object_t obj;
xbps_dictionary_t filesd = arg;
unsigned int i;
const char *file, *tgt = NULL;
char *path, *p, *buf, *buf2, *lnk, *dname, *tgt_path;
int rv;
@@ -87,7 +86,7 @@ check_pkg_symlinks(struct xbps_handle *xhp, const char *pkgname, void *arg)
if (array == NULL)
return false;
for (i = 0; i < xbps_array_count(array); i++) {
for (unsigned int i = 0; i < xbps_array_count(array); i++) {
obj = xbps_array_get(array, i);
if (!xbps_dictionary_get_cstring_nocopy(obj, "target", &tgt)) {
xbps_warn_printf("%s: `%s' symlink with "

View File

@@ -46,7 +46,6 @@ pkgdb_format_021(struct xbps_handle *xhp, const char *plist_new)
{
xbps_array_t array, rdeps;
xbps_dictionary_t pkgdb, pkgd;
unsigned int i;
char *pkgname, *plist;
plist = xbps_xasprintf("%s/pkgdb.plist", xhp->metadir);
@@ -71,7 +70,7 @@ pkgdb_format_021(struct xbps_handle *xhp, const char *plist_new)
pkgdb = xbps_dictionary_create();
assert(pkgdb);
for (i = 0; i < xbps_array_count(array); i++) {
for (unsigned int i = 0; i < xbps_array_count(array); i++) {
pkgd = xbps_array_get(array, i);
xbps_dictionary_get_cstring(pkgd, "pkgname", &pkgname);
rdeps = xbps_dictionary_get(pkgd, "run_depends");

View File

@@ -128,13 +128,12 @@ list_orphans(struct xbps_handle *xhp)
{
xbps_array_t orphans;
const char *pkgver;
unsigned int i;
orphans = xbps_find_pkg_orphans(xhp, NULL);
if (orphans == NULL)
return EINVAL;
for (i = 0; i < xbps_array_count(orphans); i++) {
for (unsigned int i = 0; i < xbps_array_count(orphans); i++) {
xbps_dictionary_get_cstring_nocopy(xbps_array_get(orphans, i),
"pkgver", &pkgver);
printf("%s\n", pkgver);

View File

@@ -54,7 +54,6 @@ match_files_by_pattern(xbps_dictionary_t pkg_filesd,
xbps_array_t array;
xbps_object_t obj;
const char *keyname, *filestr, *typestr;
unsigned int i;
int x;
keyname = xbps_dictionary_keysym_cstring_nocopy(key);
@@ -71,7 +70,7 @@ match_files_by_pattern(xbps_dictionary_t pkg_filesd,
return;
array = xbps_dictionary_get_keysym(pkg_filesd, key);
for (i = 0; i < xbps_array_count(array); i++) {
for (unsigned int i = 0; i < xbps_array_count(array); i++) {
obj = xbps_array_get(array, i);
filestr = NULL;
xbps_dictionary_get_cstring_nocopy(obj, "file", &filestr);
@@ -96,7 +95,6 @@ ownedby_pkgdb_cb(struct xbps_handle *xhp,
xbps_dictionary_t pkgmetad;
xbps_array_t files_keys;
struct ffdata *ffd = arg;
unsigned int i;
const char *pkgver;
(void)obj_key;
@@ -110,7 +108,7 @@ ownedby_pkgdb_cb(struct xbps_handle *xhp,
assert(pkgmetad);
files_keys = xbps_dictionary_all_keys(pkgmetad);
for (i = 0; i < xbps_array_count(files_keys); i++) {
for (unsigned int i = 0; i < xbps_array_count(files_keys); i++) {
match_files_by_pattern(pkgmetad,
xbps_array_get(files_keys, i), ffd, pkgver);
}
@@ -127,13 +125,12 @@ ownedby(struct xbps_handle *xhp, int npatterns, char **patterns)
{
struct ffdata ffd;
char *rfile;
int i;
ffd.npatterns = npatterns;
ffd.patterns = patterns;
pthread_mutex_init(&ffd.mtx, NULL);
for (i = 0; i < npatterns; i++) {
for (int i = 0; i < npatterns; i++) {
rfile = realpath(patterns[i], NULL);
if (rfile)
patterns[i] = rfile;
@@ -150,12 +147,10 @@ repo_match_cb(struct xbps_handle *xhp _unused,
{
struct ffdata *ffd = arg;
const char *filestr;
unsigned int i;
int x;
for (i = 0; i < xbps_array_count(obj); i++) {
for (unsigned int i = 0; i < xbps_array_count(obj); i++) {
xbps_array_get_cstring_nocopy(obj, i, &filestr);
for (x = 0; x < ffd->npatterns; x++) {
for (int x = 0; x < ffd->npatterns; x++) {
if ((fnmatch(ffd->patterns[x], filestr, FNM_PERIOD)) == 0) {
printf("%s: %s (%s)\n",
key, filestr, ffd->repouri);
@@ -192,13 +187,13 @@ repo_ownedby(struct xbps_handle *xhp, int npatterns, char **patterns)
{
struct ffdata ffd;
char *rfile;
int i, rv;
int rv;
pthread_mutex_init(&ffd.mtx, NULL);
ffd.npatterns = npatterns;
ffd.patterns = patterns;
for (i = 0; i < npatterns; i++) {
for (int i = 0; i < npatterns; i++) {
rfile = realpath(patterns[i], NULL);
if (rfile)
patterns[i] = rfile;

View File

@@ -58,17 +58,17 @@ print_results(struct xbps_handle *xhp, struct search_data *sd)
{
const char *pkgver, *desc, *inststr;
char tmp[256], *out;
unsigned int i, j, tlen = 0, len = 0;
unsigned int j, tlen = 0, len = 0;
/* Iterate over results array and find out largest pkgver string */
for (i = 0; i < xbps_array_count(sd->results); i++) {
for (unsigned int i = 0; i < xbps_array_count(sd->results); i++) {
xbps_array_get_cstring_nocopy(sd->results, i, &pkgver);
len = strlen(pkgver);
if (tlen == 0 || len > tlen)
tlen = len;
i++;
}
for (i = 0; i < xbps_array_count(sd->results); i++) {
for (unsigned int i = 0; i < xbps_array_count(sd->results); i++) {
xbps_array_get_cstring_nocopy(sd->results, i, &pkgver);
xbps_array_get_cstring_nocopy(sd->results, i+1, &desc);
strncpy(tmp, pkgver, sizeof(tmp));
@@ -106,12 +106,11 @@ search_array_cb(struct xbps_handle *xhp _unused,
{
struct search_data *sd = arg;
const char *pkgver, *desc;
int x;
xbps_dictionary_get_cstring_nocopy(obj, "pkgver", &pkgver);
xbps_dictionary_get_cstring_nocopy(obj, "short_desc", &desc);
for (x = 0; x < sd->npatterns; x++) {
for (int x = 0; x < sd->npatterns; x++) {
bool vpkgfound = false;
if (xbps_match_virtual_pkg_in_dict(obj, sd->patterns[x], false))

View File

@@ -40,16 +40,14 @@ print_rdeps(struct xbps_handle *xhp, xbps_array_t rdeps,
xbps_array_t currdeps;
xbps_dictionary_t pkgd;
const char *pkgdep;
unsigned int i;
int j;
if (!origin)
(*indent)++;
for (i = 0; i < xbps_array_count(rdeps); i++) {
for (unsigned int i = 0; i < xbps_array_count(rdeps); i++) {
xbps_array_get_cstring_nocopy(rdeps, i, &pkgdep);
if (!origin || !full)
for (j = 0; j < *indent; j++)
for (int j = 0; j < *indent; j++)
putchar(' ');
printf("%s\n", pkgdep);
@@ -98,10 +96,9 @@ show_pkg_revdeps(struct xbps_handle *xhp, const char *pkg)
{
xbps_array_t reqby;
const char *pkgdep;
unsigned int i;
if ((reqby = xbps_pkgdb_get_pkg_revdeps(xhp, pkg)) != NULL) {
for (i = 0; i < xbps_array_count(reqby); i++) {
for (unsigned int i = 0; i < xbps_array_count(reqby); i++) {
xbps_array_get_cstring_nocopy(reqby, i, &pkgdep);
printf("%s\n", pkgdep);
}
@@ -132,13 +129,12 @@ repo_show_pkg_revdeps(struct xbps_handle *xhp, const char *pkg)
{
xbps_array_t revdeps;
const char *pkgver;
unsigned int i;
int rv;
revdeps = xbps_rpool_get_pkg_revdeps(xhp, pkg);
rv = errno;
for (i = 0; i < xbps_array_count(revdeps); i++) {
for (unsigned int i = 0; i < xbps_array_count(revdeps); i++) {
xbps_array_get_cstring_nocopy(revdeps, i, &pkgver);
printf("%s\n", pkgver);
}

View File

@@ -43,7 +43,6 @@ print_value_obj(const char *keyname, xbps_object_t obj,
xbps_array_t allkeys;
xbps_object_t obj2, keysym;
const char *ksymname, *value;
unsigned int i;
char size[8];
if (indent == NULL)
@@ -73,7 +72,7 @@ print_value_obj(const char *keyname, xbps_object_t obj,
case XBPS_TYPE_ARRAY:
if (!raw)
printf("%s%s:\n", indent, keyname);
for (i = 0; i < xbps_array_count(obj); i++) {
for (unsigned int i = 0; i < xbps_array_count(obj); i++) {
obj2 = xbps_array_get(obj, i);
if (xbps_object_type(obj2) == XBPS_TYPE_STRING) {
value = xbps_string_cstring_nocopy(obj2);
@@ -86,7 +85,7 @@ print_value_obj(const char *keyname, xbps_object_t obj,
break;
case XBPS_TYPE_DICTIONARY:
allkeys = xbps_dictionary_all_keys(obj);
for (i = 0; i < xbps_array_count(allkeys); i++) {
for (unsigned int i = 0; i < xbps_array_count(allkeys); i++) {
keysym = xbps_array_get(allkeys, i);
ksymname = xbps_dictionary_keysym_cstring_nocopy(keysym);
obj2 = xbps_dictionary_get_keysym(obj, keysym);
@@ -151,11 +150,10 @@ static void
print_srcrevs(const char *keyname, xbps_string_t obj)
{
const char *str = xbps_string_cstring_nocopy(obj);
unsigned int i;
/* parse string appending a \t after EOL */
printf("%s:\n ", keyname);
for (i = 0; i < strlen(str); i++) {
for (unsigned int i = 0; i < strlen(str); i++) {
if (str[i] == '\n')
printf("\n ");
else
@@ -170,10 +168,9 @@ show_pkg_info(xbps_dictionary_t dict)
xbps_array_t all_keys;
xbps_object_t obj, keysym;
const char *keyname;
unsigned int i;
all_keys = xbps_dictionary_all_keys(dict);
for (i = 0; i < xbps_array_count(all_keys); i++) {
for (unsigned int i = 0; i < xbps_array_count(all_keys); i++) {
keysym = xbps_array_get(all_keys, i);
keyname = xbps_dictionary_keysym_cstring_nocopy(keysym);
obj = xbps_dictionary_get_keysym(dict, keysym);
@@ -201,13 +198,12 @@ show_pkg_files(xbps_dictionary_t filesd)
xbps_object_t obj;
xbps_dictionary_keysym_t ksym;
const char *keyname, *file;
unsigned int i, x;
if (xbps_object_type(filesd) != XBPS_TYPE_DICTIONARY)
return EINVAL;
allkeys = xbps_dictionary_all_keys(filesd);
for (i = 0; i < xbps_array_count(allkeys); i++) {
for (unsigned int i = 0; i < xbps_array_count(allkeys); i++) {
ksym = xbps_array_get(allkeys, i);
keyname = xbps_dictionary_keysym_cstring_nocopy(ksym);
if ((strcmp(keyname, "files") &&
@@ -219,7 +215,7 @@ show_pkg_files(xbps_dictionary_t filesd)
if (array == NULL || xbps_array_count(array) == 0)
continue;
for (x = 0; x < xbps_array_count(array); x++) {
for (unsigned int x = 0; x < xbps_array_count(array); x++) {
obj = xbps_array_get(array, x);
if (xbps_object_type(obj) != XBPS_TYPE_DICTIONARY)
continue;

View File

@@ -186,7 +186,6 @@ remove_pkg(struct xbps_handle *xhp, const char *pkgname, int cols,
{
xbps_array_t reqby;
const char *pkgver;
unsigned int x;
int rv;
rv = xbps_transaction_remove_pkg(xhp, pkgname, recursive);
@@ -196,7 +195,7 @@ remove_pkg(struct xbps_handle *xhp, const char *pkgname, int cols,
printf("WARNING: %s IS REQUIRED BY %u PACKAGE%s:\n\n",
pkgname, xbps_array_count(reqby),
xbps_array_count(reqby) > 1 ? "S" : "");
for (x = 0; x < xbps_array_count(reqby); x++) {
for (unsigned int x = 0; x < xbps_array_count(reqby); x++) {
xbps_array_get_cstring_nocopy(reqby, x, &pkgver);
print_package_line(pkgver, cols, false);
}
@@ -238,7 +237,7 @@ main(int argc, char **argv)
};
struct xbps_handle xh;
const char *rootdir, *cachedir, *conffile;
int i, c, flags, rv;
int c, flags, rv;
bool yes, drun, recursive, ignore_revdeps, clean_cache;
bool orphans, reqby_force;
int maxcols;
@@ -350,7 +349,7 @@ main(int argc, char **argv)
}
}
for (i = optind; i < argc; i++) {
for (int i = optind; i < argc; i++) {
rv = remove_pkg(&xh, argv[i], maxcols, recursive);
if (rv == 0)
continue;

View File

@@ -52,8 +52,7 @@ index_add(struct xbps_handle *xhp, int argc, char **argv, bool force)
const char *oldpkgver, *arch, *oldarch;
char *pkgver, *pkgname, *sha256, *repodir, *buf;
char *tmprepodir;
unsigned int x;
int i, rv, ret = 0;
int rv, ret = 0;
bool flush = false, found = false;
idx = idxfiles = newpkgd = newpkgfilesd = curpkgd = NULL;
@@ -81,7 +80,7 @@ index_add(struct xbps_handle *xhp, int argc, char **argv, bool force)
/*
* Process all packages specified in argv.
*/
for (i = 0; i < argc; i++) {
for (int i = 0; i < argc; i++) {
/*
* Read metadata props plist dictionary from binary package.
*/
@@ -241,7 +240,7 @@ index_add(struct xbps_handle *xhp, int argc, char **argv, bool force)
/* add conf_files in pkg files array */
if (pkg_cffiles != NULL) {
for (x = 0; x < xbps_array_count(pkg_cffiles); x++) {
for (unsigned int x = 0; x < xbps_array_count(pkg_cffiles); x++) {
obj = xbps_array_get(pkg_cffiles, x);
fileobj = xbps_dictionary_get(obj, "file");
xbps_array_add(filespkgar, fileobj);
@@ -249,7 +248,7 @@ index_add(struct xbps_handle *xhp, int argc, char **argv, bool force)
}
/* add files array in pkg array */
if (pkg_files != NULL) {
for (x = 0; x < xbps_array_count(pkg_files); x++) {
for (unsigned int x = 0; x < xbps_array_count(pkg_files); x++) {
obj = xbps_array_get(pkg_files, x);
fileobj = xbps_dictionary_get(obj, "file");
xbps_array_add(filespkgar, fileobj);
@@ -257,7 +256,7 @@ index_add(struct xbps_handle *xhp, int argc, char **argv, bool force)
}
/* add links array in pkgd */
if (pkg_links != NULL) {
for (x = 0; x < xbps_array_count(pkg_links); x++) {
for (unsigned int x = 0; x < xbps_array_count(pkg_links); x++) {
obj = xbps_array_get(pkg_links, x);
fileobj = xbps_dictionary_get(obj, "file");
xbps_array_add(filespkgar, fileobj);

View File

@@ -59,12 +59,11 @@ cleaner_thread(void *arg)
struct thread_data *thd = arg;
char *filen;
const char *pkgver, *arch, *sha256;
unsigned int i;
/* process pkgs from start until end */
array = xbps_dictionary_all_keys(thd->idx);
for (i = thd->start; i < thd->end; i++) {
for (unsigned int i = thd->start; i < thd->end; i++) {
obj = xbps_array_get(array, i);
pkgd = xbps_dictionary_get_keysym(thd->idx, obj);
xbps_dictionary_get_cstring_nocopy(pkgd, "architecture", &arch);
@@ -104,12 +103,11 @@ cleaner_files_thread(void *arg)
struct thread_data *thd = arg;
const char *pkgver, *ipkgver;
char *pkgname;
unsigned int i;
/* process pkgs from start until end */
array = xbps_dictionary_all_keys(thd->idxfiles);
for (i = thd->start; i < thd->end; i++) {
for (unsigned int i = thd->start; i < thd->end; i++) {
obj = xbps_array_get(array, i);
pkgver = xbps_dictionary_keysym_cstring_nocopy(obj);
pkgname = xbps_pkg_name(pkgver);
@@ -143,8 +141,8 @@ index_clean(struct xbps_handle *xhp, const char *repodir)
xbps_dictionary_t idx, idxfiles;
const char *keyname;
char *pkgname;
unsigned int x, pkgcount, slicecount;
int i, maxthreads, rv = 0;
unsigned int pkgcount, slicecount;
int maxthreads, rv = 0;
bool flush = false;
repo = xbps_repo_open(xhp, repodir);
@@ -175,7 +173,7 @@ index_clean(struct xbps_handle *xhp, const char *repodir)
pkgcount = 0;
/* Setup threads to cleanup index and index-files */
for (i = 0; i < maxthreads; i++) {
for (int i = 0; i < maxthreads; i++) {
thd[i].thread_num = i;
thd[i].idx = idx;
thd[i].result = xbps_array_create();
@@ -189,14 +187,14 @@ index_clean(struct xbps_handle *xhp, const char *repodir)
pkgcount += slicecount;
}
/* wait for all threads */
for (i = 0; i < maxthreads; i++)
for (int i = 0; i < maxthreads; i++)
pthread_join(thd[i].thread, NULL);
/* Setup threads to cleanup index-files */
slicecount = xbps_dictionary_count(idxfiles) / maxthreads;
pkgcount = 0;
for (i = 0; i < maxthreads; i++) {
for (int i = 0; i < maxthreads; i++) {
thd[i].thread_num = i;
thd[i].idx = idx;
thd[i].idxfiles = idxfiles;
@@ -211,11 +209,11 @@ index_clean(struct xbps_handle *xhp, const char *repodir)
pkgcount += slicecount;
}
/* wait for all threads */
for (i = 0; i < maxthreads; i++)
for (int i = 0; i < maxthreads; i++)
pthread_join(thd[i].thread, NULL);
for (i = 0; i < maxthreads; i++) {
for (x = 0; x < xbps_array_count(thd[i].result); x++) {
for (int i = 0; i < maxthreads; i++) {
for (unsigned int x = 0; x < xbps_array_count(thd[i].result); x++) {
xbps_array_get_cstring_nocopy(thd[i].result,
x, &keyname);
printf("index: removed entry %s\n", keyname);
@@ -225,7 +223,7 @@ index_clean(struct xbps_handle *xhp, const char *repodir)
free(pkgname);
flush = true;
}
for (x = 0; x < xbps_array_count(thd[i].result_files); x++) {
for (unsigned int x = 0; x < xbps_array_count(thd[i].result_files); x++) {
xbps_array_get_cstring_nocopy(thd[i].result_files,
x, &keyname);
printf("index-files: removed entry %s\n", keyname);

View File

@@ -102,7 +102,7 @@ main(int argc, char **argv)
struct xferstat xfer;
const char *version, *rootdir = NULL, *confdir = NULL;
char *pkgname, *hash;
int flags = 0, i, c, rv = 0;
int flags = 0, c, rv = 0;
while ((c = getopt(argc, argv, "C:dr:V")) != -1) {
switch (c) {
@@ -247,7 +247,7 @@ main(int argc, char **argv)
if (argc < 2)
usage();
for (i = 1; i < argc; i++) {
for (int i = 1; i < argc; i++) {
hash = xbps_file_hash(argv[i]);
if (hash == NULL) {
fprintf(stderr,
@@ -263,7 +263,7 @@ main(int argc, char **argv)
if (argc != 2)
usage();
for (i = 1; i < argc; i++) {
for (int i = 1; i < argc; i++) {
rv = xbps_fetch_file(&xh, argv[i], "v");
if (rv == -1) {
printf("%s: %s\n", argv[1],