ノードの二重登録を行ってしまっていたのでちゃんとする。
@@ -45,6 +45,7 @@ | ||
45 | 45 | { |
46 | 46 | int i; |
47 | 47 | struct WDICT *pd; |
48 | + struct WDICT *rpd = NULL; | |
48 | 49 | int len = word->len; |
49 | 50 | unsigned attr; |
50 | 51 | unsigned xp = word->xp; |
@@ -68,6 +69,7 @@ | ||
68 | 69 | pd->words = calloc(pd->n_alloc = 256, sizeof(*pd->words)); |
69 | 70 | assert(pd->words != NULL); |
70 | 71 | assert(pd->nwords < pd->n_alloc); |
72 | + rpd = pd; | |
71 | 73 | } |
72 | 74 | |
73 | 75 | /* 辞書に単語を登録 */ |
@@ -104,7 +106,7 @@ | ||
104 | 106 | assert(pd->cov[i] != 0); |
105 | 107 | } |
106 | 108 | |
107 | - return pd; | |
109 | + return rpd; /* 初回登録のみレコードを返す */ | |
108 | 110 | } |
109 | 111 | |
110 | 112 | /*************************************************************** |