Closed carlos-montiers closed 5 years ago
Can't use stack, the text is accessed in a separate thread. Could use a buffer, but what if we call this from somewhere else, not restricted to the command line? Don't do false optimisations (you want to save a microsecond or two by not using malloc and checking for errors, in a function that takes seconds to output speech).
If the max command line is 8192 characters, instead of use malloc in the SAY extension for concatenate the command line for get the text, allocate stack memory with a max size of 8192, and use memory from this variable in the stack. This will save us from check error, we always have memory and the stack memory is also more fast of use. Or maybe we can create a sayTextBuffer variable for this like the stringBuffer variable ?