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

Function task_error_new

cpworker/src/task.c:135–156  ·  view source on GitHub ↗

Allocate a failed-task record. Returns NULL on allocation failure. */

Source from the content-addressed store, hash-verified

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)
136{
137 task_error_t *e = calloc(1, sizeof(task_error_t));
138 if (!e)
139 {
140 log_error("allocate memory failed");
141 return NULL;
142 }
143 if (fingerprint)
144 {
145 e->fingerprint = strdup(fingerprint);
146 if (!e->fingerprint)
147 {
148 log_error("strdup error fingerprint failed");
149 free_task_error(e);
150 return NULL;
151 }
152 }
153 e->index = index;
154 strncpy(e->errbuf, errbuf, ERROR_BUFFER_SIZE);
155 return e;
156}
157
158typedef struct TaskStatsSummarySnapshot
159{

Callers 2

task_manager_newFunction · 0.85
build_full_task_setFunction · 0.85

Calls 1

free_task_errorFunction · 0.85

Tested by

no test coverage detected