diff --git a/pkg.c b/pkg.c index 8838cb1..f87578a 100644 --- a/pkg.c +++ b/pkg.c @@ -73,6 +73,9 @@ str_has_suffix(const char *str, const char *suffix) void pkg_free(pkg_t *pkg) { + if (pkg == NULL || pkg->flags & PKG_PROPF_VIRTUAL) + return; + if (pkg->id != NULL) free(pkg->id); diff --git a/pkg.h b/pkg.h index 1ce862c..58b2e6f 100644 --- a/pkg.h +++ b/pkg.h @@ -96,6 +96,9 @@ struct tuple_ { char *value; }; +#define PKG_PROPF_NONE 0x0 +#define PKG_PROPF_VIRTUAL 0x1 + struct pkg_ { char *id; char *filename; @@ -115,6 +118,8 @@ struct pkg_ { pkg_tuple_t *vars; bool uninstalled; + + unsigned int flags; }; #define PKG_MODULE_SEPARATOR(c) ((c) == ',' || isspace ((c)))