On 11 August 2014 14:12, Karel Zak <kzak@xxxxxxxxxx> wrote: > On Sun, Aug 10, 2014 at 12:56:09PM +0100, Sami Kerola wrote: >> - char pid[32] = { '\0' }, time[64] = { '\0' }, timeq[80] = { '\0' }; >> + char pid[32], time[64], timeq[80]; > > I agree that the original code is not elegant, but "else foo[0] = > '\0'" is also pretty ugly. It would be better to set all to the > default by one line > > *pid = *time = *timeq = '\0'; > > at begin of the function. Hi Karel, Done in proposed way. https://github.com/kerolasa/lelux-utiliteetit/commit/2e31a991d10dadb2a702be6999030a945b8cf364 >> if ((process = get_process_id(ctl))) >> snprintf(pid, sizeof(pid), " %d", process); >> + else >> + pid[0] = '\0'; > > I really don't like hairy code like this. OK, I'll try to be less hairy in future. We'll see how that goes. Eventually there will be occasional hairy patch, and hopefully they are rejected in good will. -- Sami Kerola http://www.iki.fi/kerolasa/ -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html