icfp12/ovm/task.c

20 lines
550 B
C
Raw Normal View History

2009-06-26 21:13:17 +00:00
#include "task.h"
void task_free(task_t *task) {
if (!task) return;
g_slice_free1(task->in_size * sizeof(gdouble), task->in);
g_slice_free1(task->out_size * sizeof(gdouble), task->out);
g_slice_free(task_t, task);
}
task_t* task_new(gdouble scenario, guint in_size, guint out_size) {
task_t *task = g_slice_new(task_t);
task->scenario = scenario;
task->in_size = in_size;
task->out_size = out_size;
task->in = g_slice_alloc0(task->in_size * sizeof(gdouble));
task->out = g_slice_alloc0(task->out_size * sizeof(gdouble));
return task;
}