citerators · Section 3
ccol_iter_destroy
NAME
ccol_iter_destroy - destroy a unified iterator before the end
LIBRARY
C Collections (libccollections, -lccollections)
SYNOPSIS
#include <ccollections/citerators.h> /* or any container header */ ccol_iter_destroy(it);
DESCRIPTION
ccol_iter_destroy calls the ccol__free_fn callback of the iterator and then sets it to NULL. Call it where your own for loop breaks out, so the iterator doesn't stay alive until the end of the scope. An iterator from ccol_iter_declare() is destroyed by its RAII cleanup at the end of the scope anyway, so you need ccol_iter_destroy() only when the resources have to be freed before that. ccol_for_each() always destroys its iterator on the way out.
PARAMETERS
it Iterator variable that ccol_iter_declare() declares.
NOTES
Calling it on an iterator that is already NULL is safe and does nothing. After the call it is NULL, so do not use it again. The macro evaluates it exactly once, and it must be a modifiable lvalue, such as a variable or an array element.