[libvirt] [PATCH 2/6] Add DBus helper methods for creating reply messages

Jiri Denemark jdenemar at redhat.com
Fri Mar 21 12:13:27 UTC 2014


On Fri, Mar 21, 2014 at 10:51:58 +0000, Daniel Berrange wrote:
> On Thu, Mar 20, 2014 at 11:39:18AM -0600, Eric Blake wrote:
> > On 03/20/2014 11:28 AM, Daniel P. Berrange wrote:
> > > On Thu, Mar 20, 2014 at 06:16:08PM +0100, Michal Privoznik wrote:
> > >> On 20.03.2014 13:28, Daniel P. Berrange wrote:
> > >>> The test suites often have to create DBus method reply messages
> > >>> with payloads. Create two helpers for simplifying the process
> > >>> of creating replies with payloads.
> > >>>
> > >>> Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> > >>> ---
> > >>>  src/libvirt_private.syms |  2 ++
> > >>>  src/util/virdbus.c       | 60 ++++++++++++++++++++++++++++++++++++++++++++++++
> > >>>  src/util/virdbus.h       |  5 ++++
> > >>>  3 files changed, 67 insertions(+)
> > > 
> > > 
> > >>> +    ret = 0;
> > >>> + cleanup:
> > >>
> > >> Indentation's off.
> > > 
> > > Do we actually have an indentation rule for labels ? 
> > 
> > Most code starts it in the first column, with no leading space.
> > 
> > In some respects, emacs doesn't handle it well (it assumes anything in
> > the first column is a function name, so it tries to treat the label as a
> > function name when generating changelog templates); on the other hand,
> > when I hit TAB on a label, emacs reindents it to the first column (that
> > is, our .dir-locals.el requests c-file-style "K&R", and apparently that
> > style includes putting labels at one indentation layer less than the
> > rest of the code; so if you are labelling something that indents four
> > spaces, the label gets indented 0 spaces).
> > 
> > I've been going by the general rule of thumb that if emacs reindents
> > something, then my style wasn't consistent with the bulk of the code;
> > but I agree that HACKING doesn't actually mention this, and not everyone
> > uses emacs.
> 
> Yep, I'm going with what emacs does, which is indent by 1 space here.

And since it makes git diff produce better results too, I guess we could
just start doing that everytime. Even vim can be told to indent labels
by one space:

    :set cinoptions=L3

If you think 3 != 1, it's because 4 - 3 = 1, where 4 is the normal
indent.

Jirka




More information about the libvir-list mailing list