Linux bluetooth development
 help / color / mirror / Atom feed
From: Lucas De Marchi <lucas.demarchi@profusion.mobi>
To: linux-bluetooth@vger.kernel.org
Cc: Lucas De Marchi <lucas.de.marchi@gmail.com>
Subject: [PATCH BlueZ 2/6] core: Remove useless memset and make icon optional
Date: Sat,  6 Oct 2012 04:02:36 -0300	[thread overview]
Message-ID: <1349506960-9398-2-git-send-email-lucas.de.marchi@gmail.com> (raw)
In-Reply-To: <1349506960-9398-1-git-send-email-lucas.de.marchi@gmail.com>

name is not being really used anywhere, so remove it together with the
memset from Device.GetProperties().

icon is optional, so check if it's not NULL before adding it to the list
of device properties.
---

I'm about to remove this function entirely on the next patch, but I preferred
doing like this to facilitate the review, which is mostly copy and paste from
the current code.

 src/device.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/device.c b/src/device.c
index 656f109..3658eeb 100644
--- a/src/device.c
+++ b/src/device.c
@@ -318,7 +318,7 @@ static DBusMessage *get_properties(DBusConnection *conn,
 	DBusMessage *reply;
 	DBusMessageIter iter;
 	DBusMessageIter dict;
-	char name[MAX_NAME_LENGTH + 1], dstaddr[18];
+	char dstaddr[18];
 	char **str;
 	const char *ptr, *icon = NULL;
 	dbus_bool_t boolean;
@@ -345,9 +345,6 @@ static DBusMessage *get_properties(DBusConnection *conn,
 	dict_append_entry(&dict, "Address", DBUS_TYPE_STRING, &ptr);
 
 	/* Name */
-	ptr = NULL;
-	memset(name, 0, sizeof(name));
-
 	ptr = device->name;
 	dict_append_entry(&dict, "Name", DBUS_TYPE_STRING, &ptr);
 
@@ -375,7 +372,8 @@ static DBusMessage *get_properties(DBusConnection *conn,
 		dict_append_entry(&dict, "Appearance", DBUS_TYPE_UINT16, &app);
 	}
 
-	dict_append_entry(&dict, "Icon", DBUS_TYPE_STRING, &icon);
+	if (icon != NULL)
+		dict_append_entry(&dict, "Icon", DBUS_TYPE_STRING, &icon);
 
 	/* Vendor */
 	if (device->vendor)
-- 
1.7.12.2


  reply	other threads:[~2012-10-06  7:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-06  7:02 [PATCH BlueZ 1/6] gdbus: Fix up Properties.Set() code path Lucas De Marchi
2012-10-06  7:02 ` Lucas De Marchi [this message]
2012-10-06  7:02 ` [PATCH BlueZ 3/6] doc: Mark optional properties in Device interface Lucas De Marchi
2012-10-06  7:02 ` [PATCH BlueZ 4/6] core: Add DBus.Properties getters for " Lucas De Marchi
2012-10-06  7:02 ` [PATCH BlueZ 5/6] core: Add setters and signals to " Lucas De Marchi
2012-10-06  7:02 ` [PATCH BlueZ 6/6] core: Move functions to avoid forward declaration Lucas De Marchi
  -- strict thread matches above, loose matches on Subject: below --
2012-10-06  7:10 [PATCH BlueZ 1/6] gdbus: Fix up Properties.Set() code path Lucas De Marchi
2012-10-06  7:10 ` [PATCH BlueZ 2/6] core: Remove useless memset and make icon optional 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=1349506960-9398-2-git-send-email-lucas.de.marchi@gmail.com \
    --to=lucas.demarchi@profusion.mobi \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=lucas.de.marchi@gmail.com \
    /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