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
|
void
|
||||||
pkg_cache_add(pkg_t *pkg)
|
pkg_cache_add(pkg_t *pkg)
|
||||||
{
|
{
|
||||||
|
if (pkg == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
pkg_ref(pkg);
|
pkg_ref(pkg);
|
||||||
|
|
||||||
pkg_node_insert(&pkg->cache_iter, pkg, &pkg_cache);
|
pkg_node_insert(&pkg->cache_iter, pkg, &pkg_cache);
|
||||||
|
@ -62,6 +65,9 @@ pkg_cache_add(pkg_t *pkg)
|
||||||
void
|
void
|
||||||
pkg_cache_remove(pkg_t *pkg)
|
pkg_cache_remove(pkg_t *pkg)
|
||||||
{
|
{
|
||||||
|
if (pkg == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
pkg_node_delete(&pkg->cache_iter, &pkg_cache);
|
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'
|
'-lfoo' '-I/usr/include/foo' '-fPIC'
|
||||||
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --exists nonexistant; echo \$?" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --exists nonexistant; echo \$?" \
|
||||||
'1'
|
'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 \$?" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --exists 'foo > 1.2'; echo \$?" \
|
||||||
'0'
|
'0'
|
||||||
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --exists 'foo > 1.2.3'; echo \$?" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --exists 'foo > 1.2.3'; echo \$?" \
|
||||||
|
|
Loading…
Reference in New Issue