20 lines
550 B
C
20 lines
550 B
C
|
|
||
|
#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;
|
||
|
}
|