Skip to content

Commit

Permalink
Alloc on stack.
Browse files Browse the repository at this point in the history
  • Loading branch information
egorpugin committed Jan 5, 2021
1 parent d3729cb commit af4ebaa
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/dict/dict.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ int Dict::valid_word(const WERD_CHOICE& word, bool numbers_ok) const {
if (word_ptr->length() == 0) return NO_PERM;
// Allocate vectors for holding current and updated
// active_dawgs and initialize them.
auto* active_dawgs = new DawgPositionVector[2];
DawgPositionVector active_dawgs[2];
init_active_dawgs(&(active_dawgs[0]), false);
DawgArgs dawg_args(&(active_dawgs[0]), &(active_dawgs[1]), NO_PERM);
int last_index = word_ptr->length() - 1;
Expand All @@ -803,7 +803,6 @@ int Dict::valid_word(const WERD_CHOICE& word, bool numbers_ok) const {
dawg_args.active_dawgs = &(active_dawgs[0]);
}
}
delete[] active_dawgs;
return valid_word_permuter(dawg_args.permuter, numbers_ok)
? dawg_args.permuter
: NO_PERM;
Expand Down

0 comments on commit af4ebaa

Please sign in to comment.