From 47f24f2a8faf71395a1d054e9823beb000442cce Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Sun, 4 Dec 2022 01:33:45 +0100 Subject: Implement rudimentary reference counting for sqfs_object_t Implement grab/drop functions to increase/decrease reference count and destroy the object if the count drops to 0. Make sure that all objects that maintain internal references actually grab that reference, duplicate it in the copy function, drop it in the destroy handler. Signed-off-by: David Oberhollenzer --- tests/libio/get_line.c | 2 +- tests/libio/uncompress.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/libio') diff --git a/tests/libio/get_line.c b/tests/libio/get_line.c index eec53f4..2d0f9b7 100644 --- a/tests/libio/get_line.c +++ b/tests/libio/get_line.c @@ -47,7 +47,7 @@ static void run_test_case(const line_t *lines, size_t count, ret = istream_get_line(fp, &line, &line_num, flags); TEST_ASSERT(ret > 0); - sqfs_destroy(fp); + sqfs_drop(fp); } static const line_t lines_raw[] = { diff --git a/tests/libio/uncompress.c b/tests/libio/uncompress.c index 0b877d8..4ff20b5 100644 --- a/tests/libio/uncompress.c +++ b/tests/libio/uncompress.c @@ -427,6 +427,6 @@ int main(int argc, char **argv) TEST_EQUAL_I(ret, 0); /* cleanup */ - sqfs_destroy(xfrm); + sqfs_drop(xfrm); return EXIT_SUCCESS; } -- cgit v1.2.3