forked from ariadne/pkgconf
cache: handle pkg being NULL on pkg_cache_add()/pkg_cache_remove()
parent
1a49758792
commit
c04a64352f
6
cache.c
6
cache.c
|
@ -49,6 +49,9 @@ pkg_cache_lookup(const char *id)
|
|||
void
|
||||
pkg_cache_add(pkg_t *pkg)
|
||||
{
|
||||
if (pkg == NULL)
|
||||
return;
|
||||
|
||||
pkg_ref(pkg);
|
||||
|
||||
pkg_node_insert(&pkg->cache_iter, pkg, &pkg_cache);
|
||||
|
@ -62,6 +65,9 @@ pkg_cache_add(pkg_t *pkg)
|
|||
void
|
||||
pkg_cache_remove(pkg_t *pkg)
|
||||
{
|
||||
if (pkg == NULL)
|
||||
return;
|
||||
|
||||
pkg_node_delete(&pkg->cache_iter, &pkg_cache);
|
||||
}
|
||||
|
||||
|
|
|
@ -64,6 +64,8 @@ run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --cflags --libs 'foo' '>' '1.2'
|
|||
'-lfoo' '-I/usr/include/foo' '-fPIC'
|
||||
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --exists nonexistant; echo \$?" \
|
||||
'1'
|
||||
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} nonexistant; echo \$?" \
|
||||
'1'
|
||||
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --exists 'foo > 1.2'; echo \$?" \
|
||||
'0'
|
||||
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --exists 'foo > 1.2.3'; echo \$?" \
|
||||
|
|
Loading…
Reference in New Issue