static void
write_info(Repo *repo, FILE *fp, int (*keyfilter)(Repo *repo, Repokey *key, void *kfdata), void *kfdata, Repodata *info, const char *location)
{
- Id h, *keyarray = 0;
- int i;
+ Id h;
+ Queue keyq;
- repo_write(repo, fp, keyfilter, kfdata, &keyarray);
+ queue_init(&keyq);
+ repo_write_filtered(repo, fp, keyfilter, kfdata, &keyq);
h = repodata_new_handle(info);
- if (keyarray)
- {
- for (i = 0; keyarray[i]; i++)
- repodata_add_idarray(info, h, REPOSITORY_KEYS, keyarray[i]);
- }
- sat_free(keyarray);
+ if (keyq.count)
+ repodata_set_idarray(info, h, REPOSITORY_KEYS, &keyq);
+ queue_free(&keyq);
repodata_set_str(info, h, REPOSITORY_LOCATION, location);
repodata_add_flexarray(info, SOLVID_META, REPOSITORY_EXTERNAL, h);
}
char **languages = 0;
int nlanguages = 0;
int i, j, k, l;
- Id *addedfileprovides = 0;
struct keyfilter_data kd;
+ Queue addedfileprovides;
memset(&kd, 0, sizeof(kd));
info = repo_add_repodata(repo, 0);
repodata_set_str(info, SOLVID_META, REPOSITORY_TOOLVERSION, LIBSOLV_TOOLVERSION);
- pool_addfileprovides_ids(repo->pool, 0, &addedfileprovides);
- if (addedfileprovides && *addedfileprovides)
+ queue_init(&addedfileprovides);
+ pool_addfileprovides_queue(repo->pool, &addedfileprovides, 0);
+ if (addedfileprovides.count)
{
kd.haveaddedfileprovides = 1;
- for (i = 0; addedfileprovides[i]; i++)
- repodata_add_idarray(info, SOLVID_META, REPOSITORY_ADDEDFILEPROVIDES, addedfileprovides[i]);
+ repodata_set_idarray(info, SOLVID_META, REPOSITORY_ADDEDFILEPROVIDES, &addedfileprovides);
}
- sat_free(addedfileprovides);
+ queue_free(&addedfileprovides);
pool_freeidhashes(repo->pool); /* free some mem */
break;
if (k < nlanguages)
continue;
- languages = sat_realloc2(languages, nlanguages + 1, sizeof(char *));
+ languages = solv_realloc2(languages, nlanguages + 1, sizeof(char *));
languages[nlanguages++] = strdup(keyname + l);
}
}
kd.languages = languages;
kd.nlanguages = nlanguages;
repodata_internalize(info);
- repo_write(repo, fp, keyfilter_other, &kd, 0);
+ repo_write_filtered(repo, fp, keyfilter_other, &kd, 0);
fclose(fp);
for (i = 0; i < nlanguages; i++)
free(languages[i]);
- sat_free(languages);
+ solv_free(languages);
repodata_free(info);
return 0;
}
if (attrname)
{
+ FILE *fp;
test_separate = 1;
- FILE *fp = fopen(attrname, "w");
+ fp = fopen(attrname, "w");
write_info(repo, fp, keyfilter_attr, 0, info, attrname);
fclose(fp);
kd.haveexternal = 1;
}
repodata_internalize(info);
- repo_write(repo, stdout, keyfilter_solv, &kd, 0);
+ repo_write_filtered(repo, stdout, keyfilter_solv, &kd, 0);
repodata_free(info);
return 0;
}