From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCHv3 1/5] Mobile broadband provider info plugin
Date: Thu, 18 Aug 2011 13:37:02 -0500 [thread overview]
Message-ID: <4E4D5BCE.7040901@gmail.com> (raw)
In-Reply-To: <4E4A7A9F.8050208@intel.com>
[-- Attachment #1: Type: text/plain, Size: 1686 bytes --]
Hi Oleg,
On 08/16/2011 09:11 AM, Oleg Zhurakivskyy wrote:
> Hello Denis,
>
> On 08/12/2011 09:55 AM, Denis Kenzior wrote:
>>> +static struct ofono_gprs_provision_data *apn_try_new(struct
>>> parser_data *data)
>>> +{
>>> + void *p;
>>> +
>>> + p = g_try_realloc(*data->settings,
>>> + sizeof(struct ofono_gprs_provision_data) *
>>> + (data->count + 1));
>>> + if (p == NULL)
>>> + return NULL;
>>> +
>>> + *data->settings = p;
>>> +
>>> + data->context = *data->settings + data->count++;
>>> +
>>> + memset(data->context, 0, sizeof(struct ofono_gprs_provision_data));
>>
>> This seems like a really big hammer. We have 3 settings we're likely to
>> provision, internet, wap, mms. The function runs synchronously and
>> oFono is not threaded. So in theory you can allocate the context
>> information statically and only copy it to the caller once you have
>> completed the parser.
>
> Hmm, statically allocated array of settings was in the previous version.
> Then the wish was to make it dynamic and to use realloc. Can we settle
> on an approach here?
>
The preference is to always allocate statically if you can get away with
it; if you do not need to use malloc/realloc, then please don't. I do
not believe the earlier feedback you received is in conflict here.
Using a static array for the parser and only allocating the return array
is the preferred approach since we should not be returning more than 1
internet, 1 wap and 1 mms setting. If you have multiple of any of these
then you should not provision as it indicates that user's input is required.
Regards,
-Denis
next prev parent reply other threads:[~2011-08-18 18:37 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-05 12:25 [PATCHv3 0/5] Mobile broadband provider info plugin Oleg Zhurakivskyy
2011-08-05 12:25 ` [PATCHv3 1/5] " Oleg Zhurakivskyy
2011-08-12 6:55 ` Denis Kenzior
2011-08-16 14:11 ` Oleg Zhurakivskyy
2011-08-18 18:37 ` Denis Kenzior [this message]
2011-08-05 12:25 ` [PATCHv3 2/5] GPRS context plan support Oleg Zhurakivskyy
2011-08-12 6:43 ` Denis Kenzior
2011-08-05 12:26 ` [PATCHv3 3/5] GPRS provisioning data " Oleg Zhurakivskyy
2011-08-05 12:26 ` [PATCHv3 4/5] Mobile broadband provider info plugin autoconf support Oleg Zhurakivskyy
2011-08-05 12:26 ` [PATCHv3 5/5] Mobile broadband provider info plugin makefile changes Oleg Zhurakivskyy
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=4E4D5BCE.7040901@gmail.com \
--to=denkenz@gmail.com \
--cc=ofono@ofono.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.