mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-02 09:01:46 -05:00
initial commit
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@3 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
b1c00dcd0a
commit
9cb0b933e2
47 changed files with 3425 additions and 0 deletions
32
src/client.c
Normal file
32
src/client.c
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#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);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue