On Sun, 2003-10-12 at 13:04, Jerry Jenkins wrote:
Dimitrie O. Paun wrote:
Why do we need the static?
Had I pasted more source code, you would have known why. LONG ALSA_WaveInit(void) { snd_pcm_t* h = NULL; snd_pcm_info_t * info; snd_pcm_hw_params_t * hw_params; WINE_WAVEOUT* wwo; char device[] = "hw";
wwo = &WOutDev[0]; /* FIXME: use better values */ wwo->device = device;
We have to keep the memory used by device[] or wwo->device even when we exit the function, because we'll access it later. Local variables’ memory are supposed to be freed after the function exits.
Sorry for breaking it. I noticed the string never gets modified, so I fixed it by casting in a recent patch.
Best Regards,
Daniel Marmier