linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Slawomir Bochenski <lkslawek@gmail.com>
To: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH obexd v2 1/3] MAP: Mark filter strings const
Date: Wed, 11 Apr 2012 16:04:02 +0200	[thread overview]
Message-ID: <CA+i+Aw2=gfaoQimn4bG8hSYRRacwMbCy9SNigs7ji-ejy0kr-w@mail.gmail.com> (raw)
In-Reply-To: <CABBYNZ+Rd8Gh+yZUOhtnqHc-r4PKuxqgzMDYRJMoPpvhKv=jAQ@mail.gmail.com>

On Wed, Apr 11, 2012 at 3:19 PM, Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
> Hi Slawomir,
>
> On Tue, Apr 10, 2012 at 5:47 PM, Slawomir Bochenski <lkslawek@gmail.com> wrote:
>> This structure is used for giving filters as input argument to
>> messages_get_messages_listing(). There is no need for the string members
>> to be modifiable in this context. And making them const plays well with
>> map_ap_get_string(), from which the values of these members are going to
>> be retrieved.
>> ---
>> v2: Turn on verbose mode in commit messages
>>
>>  plugins/messages.h |    8 ++++----
>>  1 files changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/plugins/messages.h b/plugins/messages.h
>> index 00a040c..2cdd92f 100644
>> --- a/plugins/messages.h
>> +++ b/plugins/messages.h
>> @@ -111,11 +111,11 @@ struct messages_event {
>>  struct messages_filter {
>>        uint32_t parameter_mask;
>>        uint8_t type;
>> -       char *period_begin;
>> -       char *period_end;
>> +       const char *period_begin;
>> +       const char *period_end;
>>        uint8_t read_status;
>> -       char *recipient;
>> -       char *originator;
>> +       const char *recipient;
>> +       const char *originator;
>>        uint8_t priority;
>>  };
>>
>> --
>> 1.7.5.1
>
> Don't you need to free them at some point? If it is just a reference
> then it is probably fine, but if you have to free them then it might
> be better this way.

Just reference to strings stored in another data structure, which
takes care of freeing them when request is finished.

>
> --
> Luiz Augusto von Dentz

-- 
Slawomir Bochenski

  reply	other threads:[~2012-04-11 14:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-10 14:47 [PATCH obexd v2 1/3] MAP: Mark filter strings const Slawomir Bochenski
2012-04-10 14:47 ` [PATCH obexd v2 2/3] MAP: Input parameters for GetMessagesListing Slawomir Bochenski
2012-04-10 14:47 ` [PATCH obexd v2 3/3] MAP: Output " Slawomir Bochenski
2012-04-11 13:19 ` [PATCH obexd v2 1/3] MAP: Mark filter strings const Luiz Augusto von Dentz
2012-04-11 14:04   ` Slawomir Bochenski [this message]
2012-04-12 11:40     ` Johan Hedberg

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='CA+i+Aw2=gfaoQimn4bG8hSYRRacwMbCy9SNigs7ji-ejy0kr-w@mail.gmail.com' \
    --to=lkslawek@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@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;
as well as URLs for NNTP newsgroup(s).