5
spd_malloc(size_t bytes)
10
if(mem == NULL) FATAL("Can't allocate memmory.\n");
16
spd_realloc(void *ptr, size_t bytes)
20
mem = realloc(ptr, bytes);
21
if(mem == NULL) FATAL("Can't allocate memmory.\n");
29
if (data != NULL) free(data);
33
spd_strdup(char* string)
37
if (string == NULL) return NULL;
39
newstr = strdup(string);
41
FATAL("Can't duplicate a string of characters, not enough memmory");
51
new = spd_malloc(sizeof(TSpeechDQueue));
53
/* Initialize all the queues to be empty */
64
spd_fdset_copy(TFDSetElement old)
69
new.language = spd_strdup(old.language);
70
new.synthesis_voice = spd_strdup(old.synthesis_voice);
71
new.client_name = spd_strdup(old.client_name);
72
new.output_module = spd_strdup(old.output_module);
73
new.index_mark = spd_strdup(old.index_mark);
74
new.audio_output_method = spd_strdup(old.audio_output_method);
75
new.audio_oss_device = spd_strdup(old.audio_oss_device);
76
new.audio_alsa_device = spd_strdup(old.audio_alsa_device);
77
new.audio_nas_server = spd_strdup(old.audio_nas_server);
78
new.audio_pulse_server = spd_strdup(old.audio_pulse_server);
86
spd_message_copy(TSpeechDMessage *old)
88
TSpeechDMessage* new = NULL;
90
if (old == NULL) return NULL;
92
new = (TSpeechDMessage *) spd_malloc(sizeof(TSpeechDMessage));
8
TFDSetElement spd_fdset_copy(TFDSetElement old)
13
new.msg_settings.voice.language =
14
g_strdup(old.msg_settings.voice.language);
15
new.msg_settings.voice.name = g_strdup(old.msg_settings.voice.name);
16
new.client_name = g_strdup(old.client_name);
17
new.output_module = g_strdup(old.output_module);
18
new.index_mark = g_strdup(old.index_mark);
19
new.audio_output_method = g_strdup(old.audio_output_method);
20
new.audio_oss_device = g_strdup(old.audio_oss_device);
21
new.audio_alsa_device = g_strdup(old.audio_alsa_device);
22
new.audio_nas_server = g_strdup(old.audio_nas_server);
23
new.audio_pulse_server = g_strdup(old.audio_pulse_server);
29
TSpeechDMessage *spd_message_copy(TSpeechDMessage * old)
31
TSpeechDMessage *new = NULL;
36
new = (TSpeechDMessage *) g_malloc(sizeof(TSpeechDMessage));
95
new->buf = spd_malloc((old->bytes+1) * sizeof(char));
39
new->buf = g_malloc((old->bytes + 1) * sizeof(char));
96
40
memcpy(new->buf, old->buf, old->bytes);
97
new->buf[new->bytes] = 0;
98
new->settings = spd_fdset_copy(old->settings);
41
new->buf[new->bytes] = 0;
42
new->settings = spd_fdset_copy(old->settings);
104
mem_free_fdset(TFDSetElement *fdset)
106
/* Don't forget that only these items are filled in
107
in a TSpeechDMessage */
108
spd_free(fdset->client_name);
109
spd_free(fdset->language);
110
spd_free(fdset->synthesis_voice);
111
spd_free(fdset->output_module);
112
spd_free(fdset->index_mark);
113
spd_free(fdset->audio_output_method);
114
spd_free(fdset->audio_oss_device);
115
spd_free(fdset->audio_alsa_device);
116
spd_free(fdset->audio_nas_server);
117
spd_free(fdset->audio_pulse_server);
121
mem_free_message(TSpeechDMessage *msg)
123
if (msg == NULL) return;
125
mem_free_fdset(&(msg->settings));
47
void mem_free_fdset(TFDSetElement * fdset)
49
/* Don't forget that only these items are filled in
50
in a TSpeechDMessage */
51
g_free(fdset->client_name);
52
g_free(fdset->msg_settings.voice.language);
53
g_free(fdset->msg_settings.voice.name);
54
g_free(fdset->output_module);
55
g_free(fdset->index_mark);
56
g_free(fdset->audio_output_method);
57
g_free(fdset->audio_oss_device);
58
g_free(fdset->audio_alsa_device);
59
g_free(fdset->audio_nas_server);
60
g_free(fdset->audio_pulse_server);
63
void mem_free_message(TSpeechDMessage * msg)
68
mem_free_fdset(&(msg->settings));