Re: Phonebook functions for BlueZ

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

 



Hi Johan,

> > > > +	if (g_str_equal(property, "direction")) {
> > > > +		dbus_message_iter_get_basic(&sub, &direction);
> > > > +	} else if (g_str_equal(property, "peer")) {
> > > > +		dbus_message_iter_get_basic(&sub, &peer);
> > > > +		vc->number = g_strdup(peer);
> > > > +	} else if (g_str_equal(property, "reason")) {
> > > > +		dbus_message_iter_get_basic(&sub, &reason);
> > > > +	} else if (g_str_equal(property, "auxstatus")) {
> > > > +		dbus_message_iter_get_basic(&sub, &auxstatus);
> > > > +	} else if (g_str_equal(property, "line")) {
> > > > +		dbus_message_iter_get_basic(&sub, &line);
> > > > +	}
> > > 
> > > No braces for one-line scopes.
> > Well, here we have a conflict: The kernel style guide says that if one
> > of the blocks has braces the other one should also have, even if it is a
> > single line.
> 
> Yesh, I noticed the same thing when checking the kernel coding style
> guidelines. Most of BlueZ code is in conflict with the kernel coding
> style in this respect, so I think we'd need some comment from Marcel on
> what exactly he wants the BlueZ style to be (might be that I've already
> discussed this a long time ago with him but I can't remember the outcome
> right now).

there is not real rule here that can be followed and will be true in all
cases. As long as the code is easy to read and understand it is fine. It
goes more like this: If the else statement is by itself then don't
bother with braces around it. Even if the if needs braces. If you have
multiple else if then the braces are actually a good idea. I would
almost go that far for complex ones like the one above using braces
would make it less error prone if you change something later. Even if
the compiler actually does warn you these days.

Use your own personal judgment here. However if the reviewing the code
make my brain hurt, then you did it wrong ;)

Regards

Marcel


--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux