[PATCH 2/2] bearer-mbim: parse replies on failure

Bjørn Mork bjorn at mork.no
Fri Dec 20 00:25:08 PST 2013


Aleksander Morgado <aleksander at lanedo.com> writes:
> On 20/12/13 08:35, Bjørn Mork wrote:
>
>> But wouldn't you have saved yourself a bit of worrying if all functions
>> potentinally allocating new errors, like mbim_message_connect_response_parse,
>> also included something like:
>> 
>>  if (*error)
>>     g_error_free (*error);
>> 
>> ?
>> 
>
> You mean within the method itself?

Yup.

> If so, that's not what glib/gio functions usually do.

Which I don't know anything about, and of course is an important point.


> If you pass a GError pointer to be filled with an
> error, the GError needs to be empty or it will dump ugly warnings.
> Otherwise, how would you know if the important error was the first one
> or the second one? In our case, the important one is actually the first
> one, the one before the parsing error.

Another good point.  Yes, you are right. It's best to let the caller
handle this.


Bjørn


More information about the ModemManager-devel mailing list