From 9cb0b933e260008c6a03e24a4a149f726b8d86b2 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 8 Jun 2004 23:54:24 +0000 Subject: initial commit git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@3 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/client.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/client.c (limited to 'src/client.c') diff --git a/src/client.c b/src/client.c new file mode 100644 index 00000000..56d85734 --- /dev/null +++ b/src/client.c @@ -0,0 +1,32 @@ +#include +#include +#include + +#include "client.h" + +struct client *client_new(struct core *core, const char *protocol_name, char *name) { + struct client *c; + int r; + assert(core); + + c = malloc(sizeof(struct client)); + assert(c); + c->protocol_name = protocol_name; + c->name = name ? strdup(name) : NULL; + c->kill = NULL; + c->userdata = NULL; + c->core = core; + + r = idxset_put(core->clients, c, &c->index); + assert(c->index != IDXSET_INVALID && r >= 0); + + return c; +} + +void client_free(struct client *c) { + assert(c && c->core); + + idxset_remove_by_data(c->core->clients, c, NULL); + free(c->name); + free(c); +} -- cgit