- if (!gc->task.pre_select) {
- gc->task.pre_select = gc_pre_select;
- gc->task.post_select = gc_post_select;
- snprintf(gc->task.status, sizeof(gc->task.status) - 1, "%s", name);
- gc->task.status[sizeof(gc->task.status) - 1] = '\0';
- register_task(&gc->task);
- }
+
+ gc->task = task_register(&(struct task_info) {
+ .name = name,
+ .pre_select = gc_pre_select,
+ .post_select = gc_post_select,
+ .context = gc,
+ }, s);