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
29
src/packet.c
Normal file
29
src/packet.c
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "packet.h"
|
||||
|
||||
struct packet* packet_new(uint32_t length) {
|
||||
struct packet *p;
|
||||
assert(length);
|
||||
p = malloc(sizeof(struct packet)+length);
|
||||
assert(p);
|
||||
|
||||
p->ref = 1;
|
||||
p->length = length;
|
||||
return p;
|
||||
}
|
||||
|
||||
struct packet* packet_ref(struct packet *p) {
|
||||
assert(p && p->ref >= 1);
|
||||
p->ref++;
|
||||
return p;
|
||||
}
|
||||
|
||||
void packet_unref(struct packet *p) {
|
||||
assert(p && p->ref >= 1);
|
||||
p->ref--;
|
||||
|
||||
if (p->ref == 0)
|
||||
free(p);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue