projects
/
YACASL2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ソースの書き方を変更
[YACASL2.git]
/
src
/
cerr.c
diff --git
a/src/cerr.c
b/src/cerr.c
index
069564b
..
24f620d
100644
(file)
--- a/
src/cerr.c
+++ b/
src/cerr.c
@@
-42,10
+42,9
@@
bool addcerrlist(int newerrc, CERR newerrv[])
p = q->next = malloc_chk(sizeof(CERRLIST), "cerrlist.next");
}
for(i = 0; i < newerrc; i++) {
p = q->next = malloc_chk(sizeof(CERRLIST), "cerrlist.next");
}
for(i = 0; i < newerrc; i++) {
- p->cerr = &(newerrv[i]);
- p->next = malloc_chk(sizeof(CERRLIST), "cerrlist.next");
+ p->cerr = &newerrv[i];
q = p;
q = p;
- p = p->next;
+ p = p->next
= malloc_chk(sizeof(CERRLIST), "cerrlist.next")
;
}
q->next = NULL;
return true;
}
q->next = NULL;
return true;
@@
-89,13
+88,15
@@
void setcerr(int num, const char *str)
char *getcerrmsg(int num)
{
CERRLIST *p;
char *getcerrmsg(int num)
{
CERRLIST *p;
+ char *msg = "unknown error";
for(p = cerrlist; p != NULL; p = p->next) {
if(num == p->cerr->num) {
for(p = cerrlist; p != NULL; p = p->next) {
if(num == p->cerr->num) {
- return p->cerr->msg;
+ msg = p->cerr->msg;
+ break;
}
}
}
}
- return
"unknown error"
;
+ return
msg
;
}
/**
}
/**
@@
-105,14
+106,13
@@
void freecerr()
{
CERRLIST *p = cerrlist, *q;
{
CERRLIST *p = cerrlist, *q;
+ /* 現在のエラーメッセージを解放 */
+ free_chk(cerr->msg, "cerr.msg");
+ /* 現在のエラーを解放 */
+ free_chk(cerr, "cerr");
/* エラーリストを解放 */
/* エラーリストを解放 */
-
while(p != NULL
) {
+
for(p = cerrlist; p != NULL; p = q
) {
q = p->next;
free_chk(p, "freecerr.p");
q = p->next;
free_chk(p, "freecerr.p");
- p = q;
}
}
- /* 現在のエラーメッセージを解放 */
- /* free_chk(cerr->msg, "cerr->msg"); */
- /* 現在のエラーを解放 */
- free_chk(cerr, "cerr");
}
}