struct ccase
{
struct case_data *case_data; /* Actual data. */
-#if GLOBAL_DEBUGGING
+#if DEBUGGING
struct ccase *this; /* Detects unauthorized move/copy. */
#endif
};
union value values[1]; /* Values. */
};
-#ifdef GLOBAL_DEBUGGING
+#ifdef DEBUGGING
#define CASE_INLINE
#else
#define CASE_INLINE static
void case_unshare (struct ccase *);
-#ifndef GLOBAL_DEBUGGING
+#ifndef DEBUGGING
#include <stdlib.h>
-#include "str.h"
+#include <libpspp/str.h>
static inline void
case_nullify (struct ccase *c)
static inline void
case_move (struct ccase *dst, struct ccase *src)
{
- *dst = *src;
- src->case_data = NULL;
+ if (dst != src)
+ {
+ *dst = *src;
+ src->case_data = NULL;
+ }
}
static inline void
const struct ccase *src, size_t src_idx,
size_t value_cnt)
{
- if (dst->case_data->ref_cnt > 1)
- case_unshare (dst);
if (dst->case_data != src->case_data || dst_idx != src_idx)
- memmove (dst->case_data->values + dst_idx,
- src->case_data->values + src_idx,
- sizeof *dst->case_data->values * value_cnt);
+ {
+ if (dst->case_data->ref_cnt > 1)
+ case_unshare (dst);
+ memmove (dst->case_data->values + dst_idx,
+ src->case_data->values + src_idx,
+ sizeof *dst->case_data->values * value_cnt);
+ }
}
static inline void
case_unshare (c);
return &c->case_data->values[idx];
}
-#endif /* !GLOBAL_DEBUGGING */
+#endif /* !DEBUGGING */
#endif /* case.h */