src/protocols/novell/nmrequest.c

changeset 9360
c40bc951573a
parent 8933
0f1e8160581d
equal deleted inserted replaced
9359:89c40efa7f7b 9360:c40bc951573a
18 * 18 *
19 */ 19 */
20 20
21 #include "nmrequest.h" 21 #include "nmrequest.h"
22 22
23 static int count = 0;
24
23 struct _NMRequest 25 struct _NMRequest
24 { 26 {
25 int trans_id; 27 int trans_id;
26 char *cmd; 28 char *cmd;
27 int gmt; 29 int gmt;
30 nm_response_cb callback; 32 nm_response_cb callback;
31 int ref_count; 33 int ref_count;
32 NMERR_T ret_code; 34 NMERR_T ret_code;
33 }; 35 };
34 36
35 37 NMRequest *nm_create_request(const char *cmd, int trans_id, int gmt, nm_response_cb cb,
36 NMRequest * 38 gpointer resp_data, gpointer user_define)
37 nm_create_request(const char *cmd, int trans_id, int gmt)
38 { 39 {
39 NMRequest *req; 40 NMRequest *req;
40 41
41 if (cmd == NULL) 42 if (cmd == NULL)
42 return NULL; 43 return NULL;
43 44
44 req = g_new0(NMRequest, 1); 45 req = g_new0(NMRequest, 1);
45 req->cmd = g_strdup(cmd); 46 req->cmd = g_strdup(cmd);
46 req->trans_id = trans_id; 47 req->trans_id = trans_id;
47 req->gmt = gmt; 48 req->gmt = gmt;
49 req->callback = cb;
50 req->data = resp_data;
51 req->user_define = user_define;
48 req->ref_count = 1; 52 req->ref_count = 1;
53
54 gaim_debug_info("novell", "Creating NMRequest instance, total=%d\n", ++count);
49 55
50 return req; 56 return req;
51 } 57 }
52 58
53 void 59 void
55 { 61 {
56 if (req && (--req->ref_count == 0)) { 62 if (req && (--req->ref_count == 0)) {
57 if (req->cmd) 63 if (req->cmd)
58 g_free(req->cmd); 64 g_free(req->cmd);
59 g_free(req); 65 g_free(req);
66
67 gaim_debug_info("novell",
68 "Releasing NMRequest instance, total=%d\n", --count);
60 } 69 }
70
61 } 71 }
62 72
63 void 73 void
64 nm_request_add_ref(NMRequest * req) 74 nm_request_add_ref(NMRequest * req)
65 { 75 {

mercurial