+/* Internal "destroy" function for missing value-filtering
+ casereader. */
+static bool
+casereader_filter_missing_destroy (void *cfm_)
+{
+ struct casereader_filter_missing *cfm = cfm_;
+ free (cfm->vars);
+ free (cfm);
+ return true;
+}
+\f
+/* Case-counting casereader. */
+
+static bool casereader_counter_include (const struct ccase *, void *);
+
+/* Creates and returns a new casereader that counts the number of
+ cases that have been read from it. *COUNTER is initially set
+ to INITIAL_VALUE, then incremented by 1 each time a case is read.
+
+ Counting casereaders must be used very cautiously: if a
+ counting casereader is cloned or if the casereader_peek
+ function is used on it, then the counter's value can be higher
+ than expected because of the buffering that goes on behind the
+ scenes.
+
+ The counter is only incremented as cases are actually read
+ from the casereader. In particular, if the casereader is
+ destroyed before all cases have been read from the casereader,
+ cases never read will not be included in the count.
+
+ After this function is called, READER must not ever again
+ be referenced directly. It will be destroyed automatically
+ when the filtering casereader is destroyed. */