libpkgconf: pkg: add refcount debugging

pull/164/head
William Pitcock 2017-12-05 17:24:57 -06:00
parent b6a56c8728
commit 4c0cc29277
1 changed files with 4 additions and 0 deletions

View File

@ -480,6 +480,8 @@ pkgconf_pkg_ref(const pkgconf_client_t *client, pkgconf_pkg_t *pkg)
(void) client;
pkg->refcount++;
PKGCONF_TRACE(client, "refcount@%p: %d", pkg, pkg->refcount);
return pkg;
}
@ -498,6 +500,8 @@ void
pkgconf_pkg_unref(pkgconf_client_t *client, pkgconf_pkg_t *pkg)
{
pkg->refcount--;
PKGCONF_TRACE(client, "refcount@%p: %d", pkg, pkg->refcount);
if (pkg->refcount <= 0)
pkgconf_pkg_free(client, pkg);
}