Re: [PATCH 1/8] logger: tidy few indentation issues

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

 



On Mon, Mar 16, 2015 at 12:22:51PM +0100, Rainer Gerhards wrote:
> On Sun, Mar 15, 2015 at 1:54 PM, Sami Kerola <kerolasa@xxxxxx> wrote:
> 
> Quick question on this (especially for future work):
> 
> > @@ -387,29 +386,35 @@ static void syslog_rfc3164_header(struct logger_ctl *const ctl)
> >  #define NILVALUE "-"
> >  static void syslog_rfc5424_header(struct logger_ctl *const ctl)
> >  {
> > +       char *time;
> > +       char *hostname;
> > +       char *const app_name = ctl->tag;
> > +       char *procid;
> > +       char *const msgid = xstrdup(ctl->msgid ? ctl->msgid : NILVALUE);
> > +       char *structured_data;
> 
> Is it project policy to always define variables at the beginning of
> the function? I ask because I used to do that as well, before I got

 at beginning of the { block }, for example:

 if (foo) {
    char *foostr = strdup(whatever);

    do_foo(foostr);
    free(foostr);
 }

 is fine.

> Also on the idention: I assume indention via tabs with tabwidth 4. Is
> there a style document I an look at?

 If possible (e.g. new/refactored stuff) then we usually follow kernel:
 https://www.kernel.org/doc/Documentation/CodingStyle

 ... but there are many old utils where it's better to follow already
 used codding style than mix more styles together.

> Thanks and sorry for the extra effort.

 Ah, this is a real detail...

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com
--
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




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux