mirror of
https://github.com/linux-speakup/espeakup.git
synced 2026-08-24 00:24:17 +02:00
change code to use allocMem wrapper for memory allocation
One of the new string handling routines is a wrapper for allocating memory. This commit changes the rest of the code to take advantage of that wrapper.
This commit is contained in:
parent
6180ff6e49
commit
3b4b6d0cbc
3 changed files with 10 additions and 22 deletions
12
softsynth.c
12
softsynth.c
|
|
@ -45,11 +45,7 @@ static void queue_add_cmd(enum command_t cmd, enum adjust_t adj, int value)
|
|||
struct espeak_entry_t *entry;
|
||||
int added = 0;
|
||||
|
||||
entry = malloc(sizeof(struct espeak_entry_t));
|
||||
if (!entry) {
|
||||
perror("unable to allocate memory for queue entry");
|
||||
return;
|
||||
}
|
||||
entry = allocMem(sizeof(struct espeak_entry_t));
|
||||
entry->cmd = cmd;
|
||||
entry->adjust = adj;
|
||||
entry->value = value;
|
||||
|
|
@ -67,11 +63,7 @@ static void queue_add_text(char *txt, size_t length)
|
|||
struct espeak_entry_t *entry;
|
||||
int added = 0;
|
||||
|
||||
entry = malloc(sizeof(struct espeak_entry_t));
|
||||
if (!entry) {
|
||||
perror("unable to allocate memory for queue entry");
|
||||
return;
|
||||
}
|
||||
entry = allocMem(sizeof(struct espeak_entry_t));
|
||||
entry->cmd = CMD_SPEAK_TEXT;
|
||||
entry->adjust = ADJ_SET;
|
||||
entry->buf = strdup(txt);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue