MCPcopy Create free account
hub / github.com/SpacehuhnTech/SimpleCLI / cmd_error_push

Function cmd_error_push

src/c/cmd_error.c:107–134  ·  view source on GitHub ↗

Push

Source from the content-addressed store, hash-verified

105
106// Push
107cmd_error* cmd_error_push(cmd_error* l, cmd_error* e, int max_size) {
108 if (max_size < 1) {
109 cmd_error_destroy_rec(l);
110 cmd_error_destroy(e);
111 return NULL;
112 }
113
114 if (!l) return e;
115
116 cmd_error* h = l;
117 int i = 1;
118
119 while (h->next) {
120 h = h->next;
121 ++i;
122 }
123
124 h->next = e;
125
126 // Remove first element if list is too big
127 if (i > max_size) {
128 cmd_error* ptr = l;
129 l = l->next;
130 cmd_error_destroy(ptr);
131 }
132
133 return l;
134}

Callers 1

parseMethod · 0.85

Calls 2

cmd_error_destroy_recFunction · 0.85
cmd_error_destroyFunction · 0.85

Tested by

no test coverage detected