Linux bluetooth development
 help / color / mirror / Atom feed
From: Johan Hedberg <johan.hedberg@nokia.com>
To: Radoslaw Jablonski <ext-jablonski.radoslaw@nokia.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH 2/2] Fix multiple phone number problem in pull vcard
Date: Mon, 9 Aug 2010 10:01:31 -0400	[thread overview]
Message-ID: <20100809140131.GB10150@jh-x301> (raw)
In-Reply-To: <1281352651-30943-1-git-send-email-ext-jablonski.radoslaw@nokia.com>

Hi Radek,

On Mon, Aug 09, 2010, Radoslaw Jablonski wrote:
> This fixes problem with pull vcard when contact has more than one home or
> work number defined in tracker - more than one VCARD was generated in
> response for pull vcard request. This was caused by nature of the data
> retrieved from tracker - contact with multiple numbers set was returned as
> many entries with identical id. Previously VCARDs was generated on the fly
> - now added contact-data caching and checking for contact id. VCARD is now
> generated when all responses of tracker were processed - and only one vcard
> is returned for one contact entry.
> ---
>  plugins/phonebook-tracker.c |  134 ++++++++++++++++++++++++++++++++++++-------
>  1 files changed, 112 insertions(+), 22 deletions(-)

Some coding style issue that need fixing:

> +struct contact_data
> +{

The { shouldn't go on it's own line, i.e. put it in the above line.

> +static struct phonebook_contact *find_contact (GSList *contacts,char *id)
> +{

Remove the space after "find_contact", add a space after ",". Since
you're not modifying id in the function it should probably be const char *
instead of char *.

> +	GSList *it;

Usually simple list iterators are called just "l".

> +	for(it = contacts; it; it = it->next) {

Space between for and (

> +	for(it = numbers; it; it = it->next) {

Same here, and call the list variable "l".

> +static GString * gen_vcards(GSList *contacts,
> +			const struct apparam_field *params)

No space between * and gen_vcards.

> +	GSList *it;

Again, call it "l".

> +	for(it = contacts; it; it = it->next) {

Space between for and (

> +	if (!cdata_present) {
> +		contact_data = g_new0(struct contact_data, 1);
> +		contact_data->contact = contact;
> +		contact_data->id = g_strdup(reply[CONTACTS_ID_COL]);
> +		data->contacts = g_slist_append(data->contacts, contact_data);
> +	}
>  	return;

Add an empty line before the return

>  	data = g_new0(struct phonebook_data, 1);
> -	data->vcards = g_string_new(NULL);
>  	data->params = params;
>  	data->user_data = user_data;
>  	data->cb = cb;
> +	data->contacts = NULL;

Since you used g_new0 setting to NULL seems redundant.

Johan

      reply	other threads:[~2010-08-09 14:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-09 11:17 [PATCH 2/2] Fix multiple phone number problem in pull vcard Radoslaw Jablonski
2010-08-09 14:01 ` Johan Hedberg [this message]

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=20100809140131.GB10150@jh-x301 \
    --to=johan.hedberg@nokia.com \
    --cc=ext-jablonski.radoslaw@nokia.com \
    --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