From 2399827bfa1062c7f782499e6dcd9f988318d422 Mon Sep 17 00:00:00 2001 From: Nick Alcock Date: Mon, 8 Jun 2020 09:24:01 +0100 Subject: libctf: add ctf_ref This allows you to bump the refcount on a ctf_file_t, so that you can smuggle it out of iterators which open and close the ctf_file_t for you around the loop body (like ctf_archive_iter). You still can't use this to preserve a ctf_file_t for longer than the lifetime of its containing entity (e.g. ctf_archive). include/ * ctf-api.h (ctf_ref): New. libctf/ * libctf.ver (ctf_ref): New. * ctf-open.c (ctf_ref): Implement it. --- include/ctf-api.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/ctf-api.h') diff --git a/include/ctf-api.h b/include/ctf-api.h index fb797a3346..faa7b727fb 100644 --- a/include/ctf-api.h +++ b/include/ctf-api.h @@ -285,6 +285,7 @@ extern ctf_file_t *ctf_simple_open (const char *, size_t, const char *, size_t, size_t, const char *, size_t, int *); extern ctf_file_t *ctf_bufopen (const ctf_sect_t *, const ctf_sect_t *, const ctf_sect_t *, int *); +extern void ctf_ref (ctf_file_t *); extern void ctf_file_close (ctf_file_t *); extern int ctf_arc_write (const char *, ctf_file_t **, size_t, -- cgit v1.2.3