pkg: remove pkg_t.uninstalled, use a property flag instead

feature/tap-sh
William Pitcock 2013-03-01 12:06:52 -06:00
parent 1fd95f90eb
commit d6fb7881d4
3 changed files with 4 additions and 5 deletions

4
main.c
View File

@ -89,7 +89,7 @@ print_fragment(pkg_fragment_t *frag)
static void
print_list_entry(const pkg_t *entry)
{
if (entry->uninstalled)
if (entry->flags & PKG_PROPF_UNINSTALLED)
return;
printf("%-30s %s - %s\n", entry->id, entry->realname, entry->description);
@ -387,7 +387,7 @@ check_uninstalled(pkg_t *pkg, void *data, unsigned int flags)
int *retval = data;
(void) flags;
if (pkg->uninstalled)
if (pkg->flags & PKG_PROPF_UNINSTALLED)
*retval = EXIT_SUCCESS;
}

2
pkg.c
View File

@ -312,7 +312,7 @@ pkg_try_specific_path(const char *path, const char *name, unsigned int flags)
if (!(flags & PKGF_NO_UNINSTALLED) && (f = fopen(uninst_locbuf, "r")) != NULL)
{
pkg = pkg_new_from_file(uninst_locbuf, f, flags);
pkg->uninstalled = true;
pkg->flags |= PKG_PROPF_UNINSTALLED;
}
else if ((f = fopen(locbuf, "r")) != NULL)
pkg = pkg_new_from_file(locbuf, f, flags);

3
pkg.h
View File

@ -78,6 +78,7 @@ struct pkg_tuple_ {
#define PKG_PROPF_VIRTUAL 0x1
#define PKG_PROPF_CACHED 0x2
#define PKG_PROPF_SEEN 0x4
#define PKG_PROPF_UNINSTALLED 0x8
struct pkg_ {
pkg_node_t cache_iter;
@ -101,8 +102,6 @@ struct pkg_ {
pkg_list_t vars;
bool uninstalled;
unsigned int flags;
};