]>
code.delx.au - pulseaudio/blob - src/client.c
8 struct client
*client_new(struct core
*core
, const char *protocol_name
, char *name
) {
13 c
= malloc(sizeof(struct client
));
15 c
->protocol_name
= protocol_name
;
16 c
->name
= name
? strdup(name
) : NULL
;
18 c
->kill_userdata
= NULL
;
21 r
= idxset_put(core
->clients
, c
, &c
->index
);
22 assert(c
->index
!= IDXSET_INVALID
&& r
>= 0);
24 fprintf(stderr
, "client: created %u \"%s\"\n", c
->index
, c
->name
);
29 void client_free(struct client
*c
) {
32 idxset_remove_by_data(c
->core
->clients
, c
, NULL
);
33 fprintf(stderr
, "client: freed %u \"%s\"\n", c
->index
, c
->name
);
38 void client_set_kill_callback(struct client
*c
, void (*kill
)(struct client
*c
, void *userdata
), void *userdata
) {
41 c
->kill_userdata
= userdata
;
44 void client_kill(struct client
*c
) {
46 c
->kill(c
, c
->kill_userdata
);