[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC][PATCH v2 15/17] guest agent: qemu-ga daemon
From: |
Jes Sorensen |
Subject: |
Re: [Qemu-devel] [RFC][PATCH v2 15/17] guest agent: qemu-ga daemon |
Date: |
Fri, 22 Apr 2011 13:51:24 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Thunderbird/3.1.9 |
On 04/22/11 11:23, Ian Molton wrote:
> On Thu, 2011-04-21 at 08:21 -0500, Michael Roth wrote:
>>>> + switch (level& G_LOG_LEVEL_MASK) {
>>>> + case G_LOG_LEVEL_ERROR: return "error";
>>>> + case G_LOG_LEVEL_CRITICAL: return "critical";
>>>> + case G_LOG_LEVEL_WARNING: return "warning";
>>>> + case G_LOG_LEVEL_MESSAGE: return "message";
>>>> + case G_LOG_LEVEL_INFO: return "info";
>>>> + case G_LOG_LEVEL_DEBUG: return "debug";
>>>> + default: return "user";
>>>> + }
>>>
>>> Urgh!
>>>
>>> No two statements on the same line please!
>
> Always wondered what the logic for this one is. IMHO the above is FAR
> neater than splitting it to near double its height.
>
> What kind of coding error does splitting this out aim to prevent?
> missing break; / return; statements? Because I dont see how it achieves
> that...
Hiding things you miss when reading the code, it's a classic for people
to do if(foo) bleh(); on the same line, and whoever reads the code will
expect the action on the next line, especially if foo is a long complex
statement.
It's one of these 'just don't do it, it bites you in the end' things.
Jes
[Qemu-devel] [RFC][PATCH v2 13/17] guest agent: command state class, Michael Roth, 2011/04/18
[Qemu-devel] [RFC][PATCH v2 14/17] guest agent: core marshal/dispatch interfaces, Michael Roth, 2011/04/18
[Qemu-devel] [RFC][PATCH v2 17/17] guest agent: build qemu-ga, add QEMU-wide gio dep, Michael Roth, 2011/04/18
[Qemu-devel] [RFC][PATCH v2 11/17] qmp proxy: build QEMU with qmp proxy, Michael Roth, 2011/04/18
Re: [Qemu-devel] [RFC][PATCH v2 00/11] QEMU Guest Agent: QMP-based host/guest communication (virtagent), Jes Sorensen, 2011/04/21
Re: [Qemu-devel] [RFC][PATCH v2 00/11] QEMU Guest Agent: QMP-based host/guest communication (virtagent), Jes Sorensen, 2011/04/21