- assert(newerrc > 0 && newerrv != NULL);
- if(cerr != NULL) {
- for(p = cerr; p != NULL; p = p->next) {
- q = p;
- }
- if((p = q->next = malloc(sizeof(CERRLIST))) == NULL) {
- goto addcerrlisterr;
+ assert(cerrc > 0 && cerrv != NULL);
+ for(int i = 0; i < cerrc; i++) {
+ if(p == NULL) {
+ stat = p = malloc_chk(sizeof(CERRLIST), "cerrlist");
+ } else {
+ p = p->next = malloc_chk(sizeof(CERRLIST), "cerrlist->next");