pkg: don't free builtin (virtual) packages

feature/tap-sh
William Pitcock 2012-05-06 20:38:48 -05:00
parent 0d2a507bcd
commit 4172dc545f
2 changed files with 8 additions and 0 deletions

3
pkg.c
View File

@ -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);

5
pkg.h
View File

@ -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)))