EST_Discrete.cc (speech_tools-2.4-release) | : | EST_Discrete.cc (speech_tools-2.5.0-release) | ||
---|---|---|---|---|
skipping to change at line 153 | skipping to change at line 153 | |||
s << d.name(i) << " "; | s << d.name(i) << " "; | |||
return s; | return s; | |||
} | } | |||
Discretes::~Discretes() | Discretes::~Discretes() | |||
{ | { | |||
int i; | int i; | |||
for (i=0; i<next_free; i++) | for (i=0; i<next_free; i++) | |||
delete discretes[i]; | delete discretes[i]; | |||
delete discretes; | delete [] discretes; | |||
} | } | |||
const int Discretes::def(const EST_StrList &vocab) | const int Discretes::def(const EST_StrList &vocab) | |||
{ | { | |||
// Define discrete, increasing the size of the table if need be | // Define discrete, increasing the size of the table if need be | |||
int i,pos; | int i,pos; | |||
if (next_free == max) | if ((next_free == max) && (max > 0)) | |||
{ | { | |||
EST_Discrete **new_discretes = new EST_Discrete *[max*2]; | EST_Discrete **new_discretes = new EST_Discrete *[max*2]; | |||
for (i=0; i<next_free; i++) | for (i=0; i<next_free; i++) | |||
new_discretes[i] = discretes[i]; | new_discretes[i] = discretes[i]; | |||
max *= 2; | max *= 2; | |||
delete discretes; | delete [] discretes; | |||
discretes = new_discretes; | discretes = new_discretes; | |||
} | } | |||
discretes[next_free] = new EST_Discrete(vocab); | discretes[next_free] = new EST_Discrete(vocab); | |||
pos = next_free + 10; | pos = next_free + 10; | |||
next_free++; | next_free++; | |||
return pos; | return pos; | |||
} | } | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added |