[SLOF] [PATCH slof v2 1/4] net-snk: Fix coding style

Alexey Kardashevskiy aik at ozlabs.ru
Fri Jan 22 11:07:42 AEDT 2016


On 01/21/2016 08:11 PM, Thomas Huth wrote:
> On 21.01.2016 10:01, Alexey Kardashevskiy wrote:
>> On 01/21/2016 07:37 PM, Thomas Huth wrote:
>>> On 21.01.2016 02:39, Alexey Kardashevskiy wrote:
>>>> This restyles function prototypes:
>>>> - return types on the same line;
>>>> - opening brace is on the next line.
>>>>
>>>> This replaces [><]* with "*" as >< are also used to resolve merge
>>>> conflicts.
>>>>
>>>> This removes trailing spaces.
>>>>
>>>> This should cause no behavioural change.
>>>>
>>>> Signed-off-by: Alexey Kardashevskiy <aik at ozlabs.ru>
>>>> ---
>>>>    clients/net-snk/app/netlib/dhcp.c     | 134
>>>> ++++++++++++++++------------------
>>>>    clients/net-snk/app/netlib/ethernet.c |  37 +++++-----
>>>>    clients/net-snk/app/netlib/ipv4.c     |  87 +++++++++-------------
>>>>    clients/net-snk/app/netlib/ipv4.h     |   2 +-
>>>>    clients/net-snk/app/netlib/ipv6.c     |  60 +++++----------
>>>>    clients/net-snk/app/netlib/tcp.c      |  16 ++--
>>>>    clients/net-snk/app/netlib/tftp.c     |  22 +++---
>>>>    clients/net-snk/app/netlib/udp.c      |  20 ++---
>>>>    8 files changed, 161 insertions(+), 217 deletions(-)
>>> ...
>>>> diff --git a/clients/net-snk/app/netlib/ethernet.c
>>>> b/clients/net-snk/app/netlib/ethernet.c
>>>> index bbfd6d1..b73239e 100644
>>>> --- a/clients/net-snk/app/netlib/ethernet.c
>>>> +++ b/clients/net-snk/app/netlib/ethernet.c
>>> ...
>>>> @@ -176,9 +175,9 @@ send_ether(int fd, void* buffer, int len)
>>>>     * @see                fill_dnshdr
>>>>     * @see                fill_btphdr
>>>>     */
>>>> -void
>>>> -fill_ethhdr(uint8_t * packet, uint16_t eth_type,
>>>> -            const uint8_t * src_mac, const uint8_t * dest_mac) {
>>>> +void fill_ethhdr(uint8_t * packet, uint16_t eth_type,
>>>> +        const uint8_t * src_mac, const uint8_t * dest_mac)
>>>
>>> Indentation looks wrong here ... wouldn't it be nicer to align the
>>> parameters in the second line with the opening "(" ?
>>
>> I like the kernel style better but in general it does not change a
>> thing. Let's vote here what style to use - kernel or QEMU :)
>
> Is this really kernel coding style? Most files that I've seen there seem
> to align to the opening "(", too. But I have to admit that this can
> become quite awkward when the return type + function name got quite long
> already, so that the opening "(" is close to the 80 columns limit already...

As I understood, the kernel style is other lines starts with 2xindent of 
the first (main) line. I cannot find this in CodingStyle but it clearly 
says "spaces are never used for indentation" and we cannot do what you say 
without spaces. I will line them up as it seems to be the preferred way, 
the prototypes are not that huge here.


-- 
Alexey


More information about the SLOF mailing list