linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lucas De Marchi <lucas.demarchi@profusion.mobi>
To: linux-bluetooth@vger.kernel.org
Cc: Lucas De Marchi <lucas.demarchi@profusion.mobi>
Subject: [PATCH BlueZ v4 02/15] gdbus: Use macros to add annotations
Date: Thu,  4 Oct 2012 04:26:26 -0300	[thread overview]
Message-ID: <1349335599-12443-3-git-send-email-lucas.de.marchi@gmail.com> (raw)
In-Reply-To: <1349335599-12443-1-git-send-email-lucas.de.marchi@gmail.com>

From: Lucas De Marchi <lucas.demarchi@profusion.mobi>

Besides being more readable this way it avoids going over 80 chars.
---
 gdbus/object.c | 40 ++++++++++++++++++++++++++++------------
 1 file changed, 28 insertions(+), 12 deletions(-)

diff --git a/gdbus/object.c b/gdbus/object.c
index 9689006..24e8285 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -76,6 +76,16 @@ static void print_arguments(GString *gstr, const GDBusArgInfo *args,
 	}
 }
 
+#define G_DBUS_ANNOTATE(prefix_, name_, value_)				\
+	prefix_ "<annotation name=\"org.freedesktop.DBus." name_ "\" "	\
+	"value=\"" value_ "\"/>\n"
+
+#define G_DBUS_ANNOTATE_DEPRECATED(prefix_) \
+	G_DBUS_ANNOTATE(prefix_, "Deprecated", "true")
+
+#define G_DBUS_ANNOTATE_NOREPLY(prefix_) \
+	G_DBUS_ANNOTATE(prefix_, "Method.NoReply", "true")
+
 static void generate_interface_xml(GString *gstr, struct interface_data *iface)
 {
 	const GDBusMethodTable *method;
@@ -90,19 +100,22 @@ static void generate_interface_xml(GString *gstr, struct interface_data *iface)
 		if (!deprecated && !noreply &&
 				!(method->in_args && method->in_args->name) &&
 				!(method->out_args && method->out_args->name))
-			g_string_append_printf(gstr, "\t\t<method name=\"%s\"/>\n",
-								method->name);
+			g_string_append_printf(gstr,
+						"\t\t<method name=\"%s\"/>\n",
+						method->name);
 		else {
-			g_string_append_printf(gstr, "\t\t<method name=\"%s\">\n",
-								method->name);
+			g_string_append_printf(gstr,
+						"\t\t<method name=\"%s\">\n",
+						method->name);
 			print_arguments(gstr, method->in_args, "in");
 			print_arguments(gstr, method->out_args, "out");
 
 			if (deprecated)
-				g_string_append_printf(gstr, "\t\t\t<annotation name=\"org.freedesktop.DBus.Deprecated\" value=\"true\"/>\n");
-
+				g_string_append_printf(gstr,
+					G_DBUS_ANNOTATE_DEPRECATED("\t\t\t"));
 			if (noreply)
-				g_string_append_printf(gstr, "\t\t\t<annotation name=\"org.freedesktop.DBus.Method.NoReply\" value=\"true\"/>\n");
+				g_string_append_printf(gstr,
+					G_DBUS_ANNOTATE_NOREPLY("\t\t\t"));
 
 			g_string_append_printf(gstr, "\t\t</method>\n");
 		}
@@ -113,15 +126,18 @@ static void generate_interface_xml(GString *gstr, struct interface_data *iface)
 						G_DBUS_SIGNAL_FLAG_DEPRECATED;
 
 		if (!deprecated && !(signal->args && signal->args->name))
-			g_string_append_printf(gstr, "\t\t<signal name=\"%s\"/>\n",
-								signal->name);
+			g_string_append_printf(gstr,
+						"\t\t<signal name=\"%s\"/>\n",
+						signal->name);
 		else {
-			g_string_append_printf(gstr, "\t\t<signal name=\"%s\">\n",
-								signal->name);
+			g_string_append_printf(gstr,
+						"\t\t<signal name=\"%s\">\n",
+						signal->name);
 			print_arguments(gstr, signal->args, NULL);
 
 			if (deprecated)
-				g_string_append_printf(gstr, "\t\t\t<annotation name=\"org.freedesktop.DBus.Deprecated\" value=\"true\"/>\n");
+				g_string_append_printf(gstr,
+					G_DBUS_ANNOTATE_DEPRECATED("\t\t\t"));
 
 			g_string_append_printf(gstr, "\t\t</signal>\n");
 		}
-- 
1.7.12.2


  parent reply	other threads:[~2012-10-04  7:26 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-04  7:26 [PATCH BlueZ v4 00/15] Properties + ObjectManager Lucas De Marchi
2012-10-04  7:26 ` [PATCH BlueZ v4 01/15] gdbus: Move typedefs up Lucas De Marchi
2012-10-04  7:26 ` Lucas De Marchi [this message]
2012-10-04  7:26 ` [PATCH BlueZ v4 03/15] gdbus: Add skeleton of DBus.Properties interface Lucas De Marchi
2012-10-04  7:26 ` [PATCH BlueZ v4 04/15] gdbus: Implement DBus.Properties.Get method Lucas De Marchi
2012-10-04  7:26 ` [PATCH BlueZ v4 05/15] gdbus: Implement DBus.Properties.GetAll method Lucas De Marchi
2012-10-04  7:26 ` [PATCH BlueZ v4 06/15] gdbus: Implement DBus.Properties.Set method Lucas De Marchi
2012-10-04  7:26 ` [PATCH BlueZ v4 07/15] gdbus: Add properties into Introspectable interface Lucas De Marchi
2012-10-04  7:26 ` [PATCH BlueZ v4 08/15] gdbus: Add support for org.freedesktop.DBus.ObjectManager interface Lucas De Marchi
2012-10-04  7:26 ` [PATCH BlueZ v4 09/15] gdbus: Group interface changes to reduce the amount of signals emitted Lucas De Marchi
2012-10-04  7:26 ` [PATCH BlueZ v4 10/15] gdbus: Only export ObjectManager interface on root path Lucas De Marchi
2012-10-04  7:26 ` [PATCH BlueZ v4 11/15] gdbus: Integrates ObjectManager with Properties interface Lucas De Marchi
2012-10-04  7:26 ` [PATCH BlueZ v4 12/15] gdbus: Simplify code for appending properties Lucas De Marchi
2012-10-04  7:26 ` [PATCH BlueZ v4 13/15] gdbus: Implement PropertiesChanged signal Lucas De Marchi
2012-10-04  7:26 ` [PATCH BlueZ v4 14/15] Use DBus.Properties on Control interface Lucas De Marchi
2012-10-04 11:42   ` Anderson Lizardo
2012-10-04 14:22     ` Johan Hedberg
2012-10-04  7:26 ` [PATCH BlueZ v4 15/15] Use DBus.Properties on Manager interface Lucas De Marchi
2012-10-04 14:17 ` [PATCH BlueZ v4 00/15] Properties + ObjectManager Johan Hedberg
2012-10-04 14:29   ` Lucas De Marchi
2012-10-04 18:11     ` Marcel Holtmann
2012-10-04 18:27       ` Lucas De Marchi
2012-10-04 19:15         ` Marcel Holtmann
2012-10-04 19:23           ` Lucas De Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1349335599-12443-3-git-send-email-lucas.de.marchi@gmail.com \
    --to=lucas.demarchi@profusion.mobi \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).