speechd-discuss
[Top][All Lists]
Advanced

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

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


From: Boris Dušek
Subject: [PATCH v2 2/3] Cleanup execution of commands in dummy
Date: Sun, 29 Jul 2012 10:24:58 +0200

>> +    for (i = 0; i < PlayCommands->len; ++i) {
>> +            play_cmd = g_array_index(PlayCommands, const gchar *, i);
>> +            const gchar *play_cmdline = g_strdup_printf("%s 
>> %s/dummy-message.wav > /dev/null 2> /dev/null", play_cmd, DATADIR);
> 
> so, there's a bug here, if we're using the default you'll end up with
> something like "play /path/to/dummy.wav > /dev/null 2>/dev/null
> /dummy.way > /dev/null 2>/dev/null"

I don't see a bug - if play_cmd=="play" and DATADIR="/path/to", then
play_cmdline will correctly be what it is supposed to be, without any
duplication:

play /path/to/dummy-message.wav > /dev/null 2> /dev/null

So unless I am missing something, there is no bug.

I might have confused you by leaving the PLAY_CMD macros in the code,
but they are not used and I have removed them already from next iteration
of this patch.

(There is a bug of not calling g_free on play_cmdline - I will fix that
along with the 2 suggestions below in next iteration)

> I'd probably fix this by just writing my own dotconf callback, that adds
> the rest of the command to the binary to run before storing it.

I guess this is not needed because the bug you mentioned does not exist :-)

>> +#define MOD_OPTION_MORE(name) \
>> +    GArray *name; \
>> +    gchar *val;     \
> 
> couldn't you declare this one inside the loop?

yep

>> +    DOTCONF_CB(name ## _cb) \
>> +    { \
>> +            int i; \
>> +            for (i = 0; i < cmd->arg_count; ++i) { \
>> +                    val = g_strdup(cmd->data.list[i]); \
>> +                    g_array_append_val(name, val); \
>> +            } \
> 
> since you know the length of the array at the start cann't you allocate
> it in one shot?

yep

I will resend the whole series with the fixes above discussed as well as
small adjustments I made after I discovered few small issues. I will describe
what changed in the v3 series w.r.t. v2 in the cover letter (PATCH 0/3).


reply via email to

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