1.1 --- a/import.c Wed Sep 19 15:26:25 2007 -0400
1.2 +++ b/import.c Wed Sep 19 17:23:53 2007 -0400
1.3 @@ -279,6 +279,12 @@
1.4 return razor_importer_finish(ctx.importer);
1.5 }
1.6
1.7 +union rpm_entry {
1.8 + void *p;
1.9 + char *string;
1.10 + char **list;
1.11 +};
1.12 +
1.13 struct razor_set *
1.14 razor_set_create_from_rpmdb(void)
1.15 {
1.16 @@ -286,8 +292,7 @@
1.17 rpmdbMatchIterator iter;
1.18 Header h;
1.19 int_32 type, count, i;
1.20 - char *name, *version, *release;
1.21 - char **properties, **property_versions;
1.22 + union rpm_entry name, version, release, properties, property_versions;
1.23 rpmdb db;
1.24
1.25 rpmReadConfigFiles(NULL, NULL);
1.26 @@ -301,31 +306,29 @@
1.27
1.28 iter = rpmdbInitIterator(db, 0, NULL, 0);
1.29 while (h = rpmdbNextIterator(iter), h != NULL) {
1.30 - headerGetEntry(h, RPMTAG_NAME, &type,
1.31 - (void **) &name, &count);
1.32 - headerGetEntry(h, RPMTAG_VERSION, &type,
1.33 - (void **) &version, &count);
1.34 - headerGetEntry(h, RPMTAG_RELEASE, &type,
1.35 - (void **) &release, &count);
1.36 - razor_importer_begin_package(importer, name, version);
1.37 + headerGetEntry(h, RPMTAG_NAME, &type, &name.p, &count);
1.38 + headerGetEntry(h, RPMTAG_VERSION, &type,&version.p, &count);
1.39 + headerGetEntry(h, RPMTAG_RELEASE, &type, &release.p, &count);
1.40 + razor_importer_begin_package(importer,
1.41 + name.string, version.string);
1.42
1.43 headerGetEntry(h, RPMTAG_REQUIRES, &type,
1.44 - (void **) &properties, &count);
1.45 + &properties.p, &count);
1.46 headerGetEntry(h, RPMTAG_REQUIREVERSION, &type,
1.47 - (void **) &property_versions, &count);
1.48 + &property_versions.p, &count);
1.49 for (i = 0; i < count; i++)
1.50 razor_importer_add_requires(importer,
1.51 - properties[i],
1.52 - property_versions[i]);
1.53 + properties.list[i],
1.54 + property_versions.list[i]);
1.55
1.56 headerGetEntry(h, RPMTAG_PROVIDES, &type,
1.57 - (void **) &properties, &count);
1.58 + &properties.p, &count);
1.59 headerGetEntry(h, RPMTAG_PROVIDEVERSION, &type,
1.60 - (void **) &property_versions, &count);
1.61 + &property_versions.p, &count);
1.62 for (i = 0; i < count; i++)
1.63 razor_importer_add_provides(importer,
1.64 - properties[i],
1.65 - property_versions[i]);
1.66 + properties.list[i],
1.67 + property_versions.list[i]);
1.68
1.69 razor_importer_finish_package(importer);
1.70 }