From d3087bb261de53557572a49458a2ae88a2d38453 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Sat, 25 Mar 2017 17:39:04 -0400 Subject: Add fz_storable_needs_reaping. Avoids needing to access the internals of reference counting. --- include/mupdf/fitz/store.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include') diff --git a/include/mupdf/fitz/store.h b/include/mupdf/fitz/store.h index 65b041f3..a93fca47 100644 --- a/include/mupdf/fitz/store.h +++ b/include/mupdf/fitz/store.h @@ -60,6 +60,11 @@ int fz_drop_key_storable(fz_context *, const fz_key_storable *); void *fz_keep_key_storable_key(fz_context *, const fz_key_storable *); void fz_drop_key_storable_key(fz_context *, const fz_key_storable *); +static inline int fz_key_storable_needs_reaping(fz_context *ctx, const fz_key_storable *ks) +{ + return ks == NULL ? 0 : (ks->store_key_refs == ks->storable.refs); +} + /* The store can be seen as a dictionary that maps keys to fz_storable values. In order to allow keys of different types to be stored, we -- cgit v1.2.3