From b0f981469cdea23225ca5c3ef0ca6759d6a92b43 Mon Sep 17 00:00:00 2001 From: j8takagi Date: Sun, 14 Mar 2010 01:19:29 +0900 Subject: [PATCH] =?utf8?q?=E3=83=A1=E3=83=A2=E3=83=AA=E7=A2=BA=E4=BF=9D?= =?utf8?q?=E6=99=82=E3=81=AE=E3=82=B5=E3=82=A4=E3=82=BA=E3=82=92=E4=BF=AE?= =?utf8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/cerr.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/cerr.c b/src/cerr.c index 5443c3e..c0146a2 100644 --- a/src/cerr.c +++ b/src/cerr.c @@ -17,20 +17,18 @@ bool addcerrlist(int newerrc, CERRARRAY newerrv[]) assert(newerrc > 0 && newerrv != NULL); if(cerr != NULL) { - p = cerr; - while (p != NULL) { + for(p = cerr; p != NULL; p = p->next) { q = p; - p = p->next; } - if((p = q->next = malloc(sizeof(CERRLIST *))) == NULL) { + if((p = q->next = malloc(sizeof(CERRLIST))) == NULL) { goto addcerrlisterr; } - } else if((p = cerr = malloc(sizeof(CERRLIST *))) == NULL) { + } else if((p = cerr = malloc(sizeof(CERRLIST))) == NULL) { goto addcerrlisterr; } for(i = 0; i < newerrc; i++) { p->err = &(newerrv[i]); - if((p->next = malloc(sizeof(CERRLIST *))) == NULL) { + if((p->next = malloc(sizeof(CERRLIST))) == NULL) { goto addcerrlisterr; } q = p; -- 2.18.0