aboutsummaryrefslogtreecommitdiff
path: root/tests/libio
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2022-12-04 01:33:45 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-01-19 16:24:56 +0100
commit47f24f2a8faf71395a1d054e9823beb000442cce (patch)
treedd01d8b69125b3dda444c9b92437ad0c5a0af9bc /tests/libio
parent4160b50a0b4c51f8b7191928cdf38d9fb0147fe2 (diff)
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 <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'tests/libio')
-rw-r--r--tests/libio/get_line.c2
-rw-r--r--tests/libio/uncompress.c2
2 files changed, 2 insertions, 2 deletions
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;
}