OLD | NEW |
1 #include "license.hunspell" | 1 #include "license.hunspell" |
2 #include "license.myspell" | 2 #include "license.myspell" |
3 | 3 |
4 #include <stdlib.h> | 4 #include <stdlib.h> |
5 #include <string.h> | 5 #include <string.h> |
6 #include <stdio.h> | 6 #include <stdio.h> |
7 #include <ctype.h> | 7 #include <ctype.h> |
8 | 8 |
9 #include "hashmgr.hxx" | 9 #include "hashmgr.hxx" |
10 #include "csutil.hxx" | 10 #include "csutil.hxx" |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 struct hentry * HashMgr::walk_hashtable(int &col, struct hentry * hp) const | 409 struct hentry * HashMgr::walk_hashtable(int &col, struct hentry * hp) const |
410 { | 410 { |
411 #ifdef HUNSPELL_CHROME_CLIENT | 411 #ifdef HUNSPELL_CHROME_CLIENT |
412 // Return NULL if dictionary is not valid. | 412 // Return NULL if dictionary is not valid. |
413 if (!bdict_reader->IsValid()) | 413 if (!bdict_reader->IsValid()) |
414 return NULL; | 414 return NULL; |
415 | 415 |
416 // This function is only ever called by one place and not nested. We can | 416 // This function is only ever called by one place and not nested. We can |
417 // therefore keep static state between calls and use |col| as a "reset" flag | 417 // therefore keep static state between calls and use |col| as a "reset" flag |
418 // to avoid changing the API. It is set to -1 for the first call. | 418 // to avoid changing the API. It is set to -1 for the first call. |
419 static hunspell::WordIterator word_iterator = | 419 // Allocate the iterator on the heap to prevent an exit time destructor. |
420 bdict_reader->GetAllWordIterator(); | 420 static hunspell::WordIterator& word_iterator = |
| 421 *new hunspell::WordIterator(bdict_reader->GetAllWordIterator()); |
421 if (col < 0) { | 422 if (col < 0) { |
422 col = 1; | 423 col = 1; |
423 word_iterator = bdict_reader->GetAllWordIterator(); | 424 word_iterator = bdict_reader->GetAllWordIterator(); |
424 } | 425 } |
425 | 426 |
426 int affix_ids[hunspell::BDict::MAX_AFFIXES_PER_WORD]; | 427 int affix_ids[hunspell::BDict::MAX_AFFIXES_PER_WORD]; |
427 static const int kMaxWordLen = 128; | 428 static const int kMaxWordLen = 128; |
428 static char word[kMaxWordLen]; | 429 static char word[kMaxWordLen]; |
429 int affix_count = word_iterator.Advance(word, kMaxWordLen, affix_ids); | 430 int affix_count = word_iterator.Advance(word, kMaxWordLen, affix_ids); |
430 if (affix_count == 0) | 431 if (affix_count == 0) |
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1152 | 1153 |
1153 int HashMgr::is_aliasm() { | 1154 int HashMgr::is_aliasm() { |
1154 return (aliasm != NULL); | 1155 return (aliasm != NULL); |
1155 } | 1156 } |
1156 | 1157 |
1157 char * HashMgr::get_aliasm(int index) { | 1158 char * HashMgr::get_aliasm(int index) { |
1158 if ((index > 0) && (index <= numaliasm)) return aliasm[index - 1]; | 1159 if ((index > 0) && (index <= numaliasm)) return aliasm[index - 1]; |
1159 HUNSPELL_WARNING(stderr, "error: bad morph. alias index: %d\n", index); | 1160 HUNSPELL_WARNING(stderr, "error: bad morph. alias index: %d\n", index); |
1160 return NULL; | 1161 return NULL; |
1161 } | 1162 } |
OLD | NEW |