+
+/* Returns true if C contains a value at V's case index with the
+ same width as V; that is, if V may plausibly be used to read
+ or write data in C.
+
+ Useful in assertions. */
+static bool UNUSED
+variable_matches_case (const struct ccase *c, const struct variable *v)
+{
+ size_t case_idx = var_get_case_index (v);
+ return (case_idx < caseproto_get_n_widths (c->proto)
+ && caseproto_get_width (c->proto, case_idx) == var_get_width (v));
+}
+
+/* Internal helper function for case_copy(). */
+static void
+copy_forward (struct ccase *dst, size_t dst_idx,
+ const struct ccase *src, size_t src_idx,
+ size_t n_values)
+{
+ size_t i;
+
+ for (i = 0; i < n_values; i++)
+ value_copy (&dst->values[dst_idx + i], &src->values[src_idx + i],
+ caseproto_get_width (dst->proto, dst_idx + i));
+}
+
+/* Internal helper function for case_copy(). */
+static void
+copy_backward (struct ccase *dst, size_t dst_idx,
+ const struct ccase *src, size_t src_idx,
+ size_t n_values)
+{
+ size_t i;
+
+ for (i = n_values; i-- != 0; )
+ value_copy (&dst->values[dst_idx + i], &src->values[src_idx + i],
+ caseproto_get_width (dst->proto, dst_idx + i));
+}
+