speechd-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/3] Cleanup execution of commands in dummy


From: Trevor Saunders
Subject: [PATCH 2/3] Cleanup execution of commands in dummy
Date: Tue, 24 Jul 2012 16:35:48 -0400

On Tue, Jul 24, 2012 at 10:13:04PM +0200, Boris Du?ek wrote:
> From: Boris Dus?ek <dusek at brailcom.org>
> 
> Current code that tries to play the dummy message using 3 command
> line players is ugly and unmaintainable. Generalize it by storing
> the 3 commands in an array and iterating over the array to execute
> them.

over all I like this, but a nit :)

> +#define PLAY_CMD(cmd) #cmd " " DATADIR "/dummy-message.wav > /dev/null 2> 
> /dev/null"
> +     static const char *const play_cmds[] = {
> +             PLAY_CMD(play),
> +             PLAY_CMD(aplay),
> +             PLAY_CMD(paplay),
> +             NULL
> +     };

> +     for (play_cmd = play_cmds; *play_cmd != NULL; ++play_cmd) {

the NULL termination seems a little strange, instead you could do
for (i = 0; i < sizeof(cmds)/sizeof(cmds[0]); i++)
though it would be nice if sizeof(array)/sizeof(array[0]) was a macro.

Trev



reply via email to

[Prev in Thread] Current Thread [Next in Thread]