const struct variable *state_var;
union value state_value;
+ size_t state_var_width;
/* Plot the roc curve */
bool curve;
roc.neg = roc.neg_weighted = 0;
roc.dict = dataset_dict (ds);
roc.state_var = NULL;
+ roc.state_var_width = -1;
lex_match (lexer, T_SLASH);
if (!parse_variables_const (lexer, dict, &roc.vars, &roc.n_vars,
goto error;
}
- value_init (&roc.state_value, var_get_width (roc.state_var));
+ roc.state_var_width = var_get_width (roc.state_var);
+ value_init (&roc.state_value, roc.state_var_width);
parse_value (lexer, &roc.state_value, roc.state_var);
goto error;
}
-
while (lex_token (lexer) != T_ENDCMD)
{
lex_match (lexer, T_SLASH);
if ( ! run_roc (ds, &roc))
goto error;
- value_destroy (&roc.state_value, var_get_width (roc.state_var));
+ if ( roc.state_var)
+ value_destroy (&roc.state_value, roc.state_var_width);
free (roc.vars);
return CMD_SUCCESS;
error:
if ( roc.state_var)
- value_destroy (&roc.state_value, var_get_width (roc.state_var));
+ value_destroy (&roc.state_value, roc.state_var_width);
free (roc.vars);
return CMD_FAILURE;
}