diff options
author | Daniel Silverstone <dsilvers@netsurf-browser.org> | 2010-04-08 11:21:50 +0000 |
---|---|---|
committer | Daniel Silverstone <dsilvers@netsurf-browser.org> | 2010-04-08 11:21:50 +0000 |
commit | 6948496d45f9de4554644346b62421c60c0a340e (patch) | |
tree | ca7738f2e75a561fb773bf3ef06c6b36f08619df /utils/ring.h | |
parent | 51b27bdf54cc15b3c2ff68ccdfbc4d7aeac47252 (diff) | |
download | netsurf-6948496d45f9de4554644346b62421c60c0a340e.tar.gz netsurf-6948496d45f9de4554644346b62421c60c0a340e.tar.bz2 |
Ensure that aborting or releasing hlcache handles will result in nascent retrieval contexts being cleaned up
svn path=/trunk/netsurf/; revision=10298
Diffstat (limited to 'utils/ring.h')
-rw-r--r-- | utils/ring.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/utils/ring.h b/utils/ring.h index d6258c240..1dfd23603 100644 --- a/utils/ring.h +++ b/utils/ring.h @@ -106,4 +106,32 @@ } while (p != ring); \ } else sizevar = 0 +/* + * Ring iteration works as follows: + * + * RING_ITERATE_START(ringtype, ring, iteratorptr) { + * code_using(iteratorptr); + * } RING_ITERATE_END(ring, iteratorptr); + * + * If you want to stop iterating (e.g. you found your answer) + * RING_ITERATE_STOP(ring, iteratorptr); + * You *MUST* abort the iteration if you do something to modify + * the ring such as deleting or adding an element. + */ + +#define RING_ITERATE_START(ringtype, ring, iteratorptr) \ + if (ring != NULL) { \ + ringtype *iteratorptr = ring; \ + do { \ + do { \ + +#define RING_ITERATE_STOP(ring, iteratorptr) \ + goto iteration_end_##ring##_##iteratorptr + +#define RING_ITERATE_END(ring, iteratorptr) \ + } while (false); \ + } while (iteratorptr != ring); \ + } \ + iteration_end_##ring##_##iteratorptr: + #endif |