MCPcopy Create free account
hub / github.com/Netis/cloud-probe / task_wrapper_new

Function task_wrapper_new

cpworker/src/task.c:111–132  ·  view source on GitHub ↗

Allocate a task wrapper node. fingerprint may be NULL (initial config allows it). * Does not take ownership of cap_task. Returns NULL on allocation failure. */

Source from the content-addressed store, hash-verified

109/* Allocate a task wrapper node. fingerprint may be NULL (initial config allows it).
110 * Does not take ownership of cap_task. Returns NULL on allocation failure. */
111static task_t *task_wrapper_new(int index, const char *fingerprint, capture_task_t *cap_task)
112{
113 task_t *t = calloc(1, sizeof(task_t));
114 if (!t)
115 {
116 log_error("allocate memory failed");
117 return NULL;
118 }
119 if (fingerprint)
120 {
121 t->fingerprint = strdup(fingerprint);
122 if (!t->fingerprint)
123 {
124 log_error("strdup task fingerprint failed");
125 free(t);
126 return NULL;
127 }
128 }
129 t->index = index;
130 t->task = cap_task;
131 return t;
132}
133
134/* Allocate a failed-task record. Returns NULL on allocation failure. */
135static task_error_t *task_error_new(int index, const char *fingerprint, const char *errbuf)

Callers 3

task_manager_newFunction · 0.85
collect_surviving_tasksFunction · 0.85
build_full_task_setFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected