-/* Reference-counted case implementation. */
-struct case_data
- {
- size_t value_cnt; /* Number of values. */
- unsigned ref_cnt; /* Reference count. */
- union value values[1]; /* Values. */
- };
-
-/* Ensures that C does not share data with any other case. */
-static void
-case_unshare (struct ccase *c)
-{
- if (c->case_data->ref_cnt > 1)
- {
- struct case_data *cd = c->case_data;
- cd->ref_cnt--;
- case_create (c, cd->value_cnt);
- memcpy (c->case_data->values, cd->values,
- sizeof *cd->values * cd->value_cnt);
- }
-}
-
-/* Returns the number of bytes needed by a case with VALUE_CNT