use a serial instead of PKGCONF_PKG_PROPF_SEEN

pull/236/head
Ariadne Conill 2021-10-07 00:23:35 -06:00
parent 7d8cc1e4ce
commit 2b82a4f63e
2 changed files with 9 additions and 4 deletions

View File

@ -20,6 +20,7 @@
#include <stdarg.h>
#include <stddef.h>
#include <stdbool.h>
#include <stdint.h>
#include <libpkgconf/libpkgconf-api.h>
#include <libpkgconf/iter.h>
#include <libpkgconf/bsdstubs.h>
@ -123,7 +124,6 @@ struct pkgconf_path_ {
#define PKGCONF_PKG_PROPF_NONE 0x00
#define PKGCONF_PKG_PROPF_STATIC 0x01
#define PKGCONF_PKG_PROPF_CACHED 0x02
#define PKGCONF_PKG_PROPF_SEEN 0x04
#define PKGCONF_PKG_PROPF_UNINSTALLED 0x08
#define PKGCONF_PKG_PROPF_VIRTUAL 0x10
@ -160,6 +160,8 @@ struct pkgconf_pkg_ {
*/
pkgconf_tuple_t *orig_prefix;
pkgconf_tuple_t *prefix;
uint64_t serial;
};
typedef bool (*pkgconf_pkg_iteration_func_t)(const pkgconf_pkg_t *pkg, void *data);
@ -194,6 +196,8 @@ struct pkgconf_client_ {
char *prefix_varname;
bool already_sent_notice;
uint64_t serial;
};
struct pkgconf_cross_personality_ {

View File

@ -1463,7 +1463,7 @@ pkgconf_pkg_walk_list(pkgconf_client_t *client,
if (pkgdep == NULL)
continue;
if (pkgdep->flags & PKGCONF_PKG_PROPF_SEEN)
if (pkgdep->serial == client->serial)
{
pkgconf_pkg_unref(client, pkgdep);
continue;
@ -1477,9 +1477,8 @@ pkgconf_pkg_walk_list(pkgconf_client_t *client,
pkgconf_audit_log_dependency(client, pkgdep, depnode);
pkgdep->flags |= PKGCONF_PKG_PROPF_SEEN;
pkgdep->serial = client->serial;
eflags |= pkgconf_pkg_traverse(client, pkgdep, func, data, depth - 1, skip_flags);
pkgdep->flags &= ~PKGCONF_PKG_PROPF_SEEN;
pkgconf_pkg_unref(client, pkgdep);
}
@ -1562,6 +1561,8 @@ pkgconf_pkg_traverse(pkgconf_client_t *client,
if (maxdepth == 0)
return eflags;
++client->serial;
PKGCONF_TRACE(client, "%s: level %d", root->id, maxdepth);
if ((root->flags & PKGCONF_PKG_PROPF_VIRTUAL) != PKGCONF_PKG_PROPF_VIRTUAL || (client->flags & PKGCONF_PKG_PKGF_SKIP_ROOT_VIRTUAL) != PKGCONF_PKG_PKGF_SKIP_ROOT_VIRTUAL)