From: Johan Hedberg <johan.hedberg@gmail.com>
To: "Gustavo F. Padovan" <gustavo@padovan.org>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH 2/2] Add SetProperty method and Debug property
Date: Wed, 16 Jun 2010 13:34:44 +0300 [thread overview]
Message-ID: <20100616103444.GB6587@jh-x301> (raw)
In-Reply-To: <1276673478-9273-2-git-send-email-gustavo@padovan.org>
Hi Gustavo,
On Wed, Jun 16, 2010, Gustavo F. Padovan wrote:
> +static DBusMessage *set_debug(DBusConnection *conn, DBusMessage *msg,
> + const char *debug_string, void *data)
> +{
> + char *old_string;
> +
> + if (!g_utf8_validate(debug_string, -1, NULL)) {
> + error("DebugString change failed: supplied string "
> + "isn't valid UTF-8");
> + return invalid_args(msg);
> + }
> +
> + old_string = __btd_get_debug();
> +
> + if (strcmp((char *)debug_string, old_string) == 0)
At least according to my manpage of strcmp the input is already const so
the case is unnecessary here. You might also want to use g_str_equal in
this case.
> + if (!__btd_set_debug((char *)debug_string))
Since __btd_set_debug g_strdup's the input the right fix is to declare
its input parameter as const, and then the need to do a cast here goes
away.
Johan
next prev parent reply other threads:[~2010-06-16 10:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-16 7:31 [PATCH 1/2] log: Add function to get/set debug_string Gustavo F. Padovan
2010-06-16 7:31 ` [PATCH 2/2] Add SetProperty method and Debug property Gustavo F. Padovan
2010-06-16 10:34 ` Johan Hedberg [this message]
2010-06-16 10:29 ` [PATCH 1/2] log: Add function to get/set debug_string Johan Hedberg
2010-06-16 13:31 ` Marcel Holtmann
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=20100616103444.GB6587@jh-x301 \
--to=johan.hedberg@gmail.com \
--cc=gustavo@padovan.org \
--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