void pkg_deinit(pkg_t * pkg)
{
+ int rem;
+ struct blob_attr *cur;
compound_depend_t *deps, *dep;
+ void *ptr;
if (pkg->name)
free(pkg->name);
pkg->state_flag = SF_OK;
pkg->state_status = SS_NOT_INSTALLED;
- deps = pkg_get_ptr(pkg, PKG_DEPENDS);
+ blob_for_each_attr(cur, pkg->blob.head, rem) {
+ switch (blob_id(cur)) {
+ case PKG_DEPENDS:
+ case PKG_CONFLICTS:
+ deps = pkg_get_ptr(pkg, blob_id(cur));
+
+ if (deps) {
+ for (dep = deps; dep->type; dep++)
+ compound_depend_deinit(dep);
- if (deps) {
- for (dep = deps; dep->type; dep++)
- compound_depend_deinit(dep);
+ free(deps);
+ }
- free(deps);
- pkg_set_ptr(pkg, PKG_DEPENDS, NULL);
- }
+ pkg_set_ptr(pkg, blob_id(cur), NULL);
+ break;
- deps = pkg_get_ptr(pkg, PKG_CONFLICTS);
+ case PKG_REPLACES:
+ case PKG_PROVIDES:
+ ptr = pkg_get_ptr(pkg, blob_id(cur));
- if (deps) {
- for (dep = deps; dep->type; dep++)
- compound_depend_deinit(dep);
+ if (ptr)
+ free(ptr);
- free(deps);
- pkg_set_ptr(pkg, PKG_CONFLICTS, NULL);
+ pkg_set_ptr(pkg, blob_id(cur), NULL);
+ break;
+
+ case PKG_CONFFILES:
+ ptr = pkg_get_ptr(pkg, blob_id(cur));
+
+ if (ptr) {
+ conffile_list_deinit(ptr);
+ free(ptr);
+ }
+
+ pkg_set_ptr(pkg, blob_id(cur), NULL);
+ break;
+ }
}
//conffile_list_deinit(&pkg->conffiles);
pkg_free_installed_files(pkg);
pkg->essential = 0;
- //blob_buf_free(&pkg->blob);
+ blob_buf_free(&pkg->blob);
}
int pkg_init_from_file(pkg_t * pkg, const char *filename)