projects
/
YACASL2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
make install機能を追加
[YACASL2.git]
/
src
/
cerr.c
diff --git
a/src/cerr.c
b/src/cerr.c
index
d595275
..
116312b
100644
(file)
--- a/
src/cerr.c
+++ b/
src/cerr.c
@@
-27,19
+27,19
@@
CERRLIST *cerrlist = NULL;
/**
* エラーリストを作成または追加する
*/
/**
* エラーリストを作成または追加する
*/
-void addcerrlist(int
newerrc, CERR new
errv[])
+void addcerrlist(int
errc, CERR
errv[])
{
int i;
{
int i;
- CERRLIST *p = NULL, *q;
+ CERRLIST *p = NULL, *q
= malloc_chk(sizeof(CERRLIST), "cerrlist")
;
- assert(
newerrc > 0 && new
errv != NULL);
- for(i = 0; i <
new
errc; i++) {
+ assert(
errc > 0 &&
errv != NULL);
+ for(i = 0; i < errc; i++) {
if(p == NULL) {
if(p == NULL) {
- p = q
= malloc_chk(sizeof(CERRLIST), "cerrlist")
;
+ p = q;
} else {
p = p->next = malloc_chk(sizeof(CERRLIST), "cerrlist.next");
}
} else {
p = p->next = malloc_chk(sizeof(CERRLIST), "cerrlist.next");
}
- p->cerr = &
new
errv[i];
+ p->cerr = &errv[i];
p->next = NULL;
}
p->next = cerrlist;
p->next = NULL;
}
p->next = cerrlist;
@@
-71,7
+71,7
@@
void setcerr(int num, const char *str)
cerr->num = num;
/* 現在のエラーメッセージを設定 */
cerr->msg = malloc_chk(CERRMSGSIZE + 1, "cerr.msg");
cerr->num = num;
/* 現在のエラーメッセージを設定 */
cerr->msg = malloc_chk(CERRMSGSIZE + 1, "cerr.msg");
- if(
str != NULL
&& strlen(str) <= CERRSTRSIZE) {
+ if(
0 < strlen(str)
&& strlen(str) <= CERRSTRSIZE) {
sprintf(cerr->msg, "%s: %s", str, getcerrmsg(cerr->num));
} else {
strcpy(cerr->msg, getcerrmsg(cerr->num));
sprintf(cerr->msg, "%s: %s", str, getcerrmsg(cerr->num));
} else {
strcpy(cerr->msg, getcerrmsg(cerr->num));