2010-09-23 12:06:53

by Rafal Michalski

[permalink] [raw]
Subject: Where "destroying" function definition is ?

Hi

Does anybody know where "destroying" function is ? - pointer to this function is
stored in "destroy" field of agent_request structure, but I can't find
definition
of this function and place where this pointer (non-NULL) is passed.
This pointer is used as below - this is a piece of code from BlueZ
(release 4.71)
- src/agent.c file.

static void agent_request_free(struct agent_request *req, gboolean destroy)
{
if (req->msg)
dbus_message_unref(req->msg);
if (req->call)
dbus_pending_call_unref(req->call);
if (req->agent && req->agent->request)
req->agent->request = NULL;
if (destroy && req->destroy)
req->destroy(req->user_data);
/* where is the function that destroy points to ??? */
g_free(req);
}

Thanks for any help.

Best regards
Rafa? Michalski


2010-09-23 14:32:12

by Rymarkiewicz Waldemar

[permalink] [raw]
Subject: RE: Where "destroying" function definition is ?

Hi Robert,

>-----Original Message-----
>From: [email protected]
>[mailto:[email protected]] On Behalf Of
>Rafa? Michalski
>Sent: Thursday, September 23, 2010 2:07 PM
>To: [email protected]
>Subject: Where "destroying" function definition is ?
>
>Hi
>
>Does anybody know where "destroying" function is ? - pointer
>to this function is stored in "destroy" field of agent_request
>structure, but I can't find definition of this function and
>place where this pointer (non-NULL) is passed.
>This pointer is used as below - this is a piece of code from
>BlueZ (release 4.71)
>- src/agent.c file.
>
>static void agent_request_free(struct agent_request *req,
>gboolean destroy) {
> if (req->msg)
> dbus_message_unref(req->msg);
> if (req->call)
> dbus_pending_call_unref(req->call);
> if (req->agent && req->agent->request)
> req->agent->request = NULL;
> if (destroy && req->destroy)
> req->destroy(req->user_data);
> /* where is the function that destroy
>points to ??? */
> g_free(req);
>}
>
>Thanks for any help.
>
>Best regards
>Rafa? Michalski

I'm not pretty sure but this feature seems be not used :)
In device.c function device_request_authentication() calls agent_request_* with NULL as the last param which is fact is a pointer to "distroying" function.


Regards,
/Waldek