aw->writer = pfm_open_writer (handle, dict, porfile_opts);
break;
}
+
+ dict_destroy (dict);
return aw;
/* Transformation. */
struct output_trns
{
- struct trns_header h; /* Header. */
struct any_writer *aw; /* Writer. */
};
parse_output_trns (enum writer_type writer_type)
{
struct output_trns *t = xmalloc (sizeof *t);
- t->h.proc = output_trns_proc;
- t->h.free = output_trns_free;
t->aw = parse_write_command (writer_type, XFORM_CMD, NULL);
if (t->aw == NULL)
{
return CMD_FAILURE;
}
- add_transformation (&t->h);
+ add_transformation (output_trns_proc, output_trns_free, t);
return CMD_SUCCESS;
}
/* Writes case C to the system file specified on XSAVE or XEXPORT. */
static int
-output_trns_proc (struct trns_header *h, struct ccase *c, int case_num UNUSED)
+output_trns_proc (void *trns_, struct ccase *c, int case_num UNUSED)
{
- struct output_trns *t = (struct output_trns *) h;
+ struct output_trns *t = trns_;
any_writer_write_case (t->aw, c);
return -1;
}
/* Frees an XSAVE or XEXPORT transformation. */
static void
-output_trns_free (struct trns_header *h)
+output_trns_free (void *trns_)
{
- struct output_trns *t = (struct output_trns *) h;
+ struct output_trns *t = trns_;
if (t != NULL)
{
static bool
rename_variables (struct dictionary *dict)
{
- int i;
+ size_t i;
int success = 0;
struct variable **v;
char **new_names;
- int nv, nn;
+ size_t nv, nn;
char *err_name;
int group;
group = 1;
while (lex_match ('('))
{
- int old_nv = nv;
+ size_t old_nv = nv;
if (!parse_variables (dict, &v, &nv, PV_NO_DUPLICATE | PV_APPEND))
goto done;
msg (SE, _("Number of variables on left side of `=' (%d) does not "
"match number of variables on right side (%d), in "
"parenthesized group %d of RENAME subcommand."),
- nv - old_nv, nn - old_nv, group);
+ (unsigned) (nv - old_nv), (unsigned) (nn - old_nv), group);
goto done;
}
if (!lex_force_match (')'))
drop_variables (struct dictionary *dict)
{
struct variable **v;
- int nv;
+ size_t nv;
lex_match ('=');
if (!parse_variables (dict, &v, &nv, PV_NONE))
keep_variables (struct dictionary *dict)
{
struct variable **v;
- int nv;
- int i;
+ size_t nv;
+ size_t i;
lex_match ('=');
if (!parse_variables (dict, &v, &nv, PV_NONE))
dict_reorder_vars (dict, v, nv);
/* Delete the remaining variables. */
- v = xrealloc (v, (dict_get_var_cnt (dict) - nv) * sizeof *v);
+ v = xnrealloc (v, dict_get_var_cnt (dict) - nv, sizeof *v);
for (i = nv; i < dict_get_var_cnt (dict); i++)
v[i - nv] = dict_get_var (dict, i);
dict_delete_vars (dict, v, dict_get_var_cnt (dict) - nv);
struct mtf_file *head; /* First file mentioned on FILE or TABLE. */
struct mtf_file *tail; /* Last file mentioned on FILE or TABLE. */
- int by_cnt; /* Number of variables on BY subcommand. */
+ size_t by_cnt; /* Number of variables on BY subcommand. */
/* Names of FIRST, LAST variables. */
char first[LONG_NAME_LEN + 1], last[LONG_NAME_LEN + 1];
for (iter = mtf.head; iter != NULL; iter = iter->next)
{
- int i;
+ size_t i;
- iter->by = xmalloc (sizeof *iter->by * mtf.by_cnt);
+ iter->by = xnmalloc (mtf.by_cnt, sizeof *iter->by);
for (i = 0; i < mtf.by_cnt; i++)
{
map = xmalloc (sizeof *map);
map->value_cnt = dict_get_next_value_idx (d);
- map->map = xmalloc (sizeof *map->map * map->value_cnt);
+ map->map = xnmalloc (map->value_cnt, sizeof *map->map);
for (i = 0; i < map->value_cnt; i++)
map->map[i] = -1;