Use C99 for loop initializers.
That means that a C99 compiler is now mandatory.
This commit is contained in:
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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))
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
Reference in New Issue
Block a user