projects
/
YACASL2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
変数名の整理
[YACASL2.git]
/
test
/
unit
/
print_cmdtype_code
/
print_cmdtype_code.c
diff --git
a/test/unit/print_cmdtype_code/print_cmdtype_code.c
b/test/unit/print_cmdtype_code/print_cmdtype_code.c
index
bb31614
..
04d311e
100644
(file)
--- a/
test/unit/print_cmdtype_code/print_cmdtype_code.c
+++ b/
test/unit/print_cmdtype_code/print_cmdtype_code.c
@@
-4,8
+4,8
@@
int compare_code(const void *a, const void *b)
{
int compare_code(const void *a, const void *b)
{
- const CMD
CODEARRAY ca = **(const CMDCODEARRAY
**)a;
- const CMD
CODEARRAY cb = **(const CMDCODEARRAY
**)b;
+ const CMD
TYPECODE ca = **(const CMDTYPECODE
**)a;
+ const CMD
TYPECODE cb = **(const CMDTYPECODE
**)b;
int diff;
if((diff = strcmp(ca.cmd, cb.cmd)) == 0) {
return ca.type - cb.type;
int diff;
if((diff = strcmp(ca.cmd, cb.cmd)) == 0) {
return ca.type - cb.type;
@@
-19,12
+19,12
@@
void print_cmdtype_code()
{
int i, j = 0;
CMDCODETAB *np;
{
int i, j = 0;
CMDCODETAB *np;
- CMD
CODEARRAY
**ar;
- ar = malloc(sizeof(*ar) * cmdcodesize);
+ CMD
TYPECODE
**ar;
+ ar = malloc(sizeof(*ar) * cmd
type
codesize);
for(i = 0; i < cmdtabsize; i++) {
np = cmdtype_code[i];
while(np != NULL) {
for(i = 0; i < cmdtabsize; i++) {
np = cmdtype_code[i];
while(np != NULL) {
- ar[j++] = np->c
ca
;
+ ar[j++] = np->c
mdtypecode
;
np = np->next;
}
}
np = np->next;
}
}
@@
-36,11
+36,16
@@
void print_cmdtype_code()
int main()
{
int main()
{
+ /* エラーの初期化 */
+ cerr = malloc_chk(sizeof(CERR), "cerr");
+ /* ハッシュ表作成 */
create_cmdtype_code();
create_cmdtype_code();
+ /* 命令表の表示 */
print_cmdtype_code();
print_cmdtype_code();
+ /* ハッシュ表解放 */
free_cmdtype_code();
free_cmdtype_code();
- if(cerr
no
!= 0) {
- printf("\terror - %d: %s\n", cerr
no, cerr
msg);
+ if(cerr
->num
!= 0) {
+ printf("\terror - %d: %s\n", cerr
->num, cerr->
msg);
freecerr();
exit(-1);
}
freecerr();
exit(-1);
}