Mercurial > audlegacy-plugins
annotate src/neon/rb.h @ 2100:14adeaf9c20f audacious-plugins-1.4.0-beta2
fix compile on ancient DBus systems
author | William Pitcock <nenolod@atheme.org> |
---|---|
date | Fri, 19 Oct 2007 03:06:01 -0500 |
parents | dc83901850df |
children | 9a9f406374c6 |
rev | line source |
---|---|
1751
dc83901850df
- Add license texts to the neon source
Ralf Ertzinger <ralf@skytale.net>
parents:
1722
diff
changeset
|
1 /* |
dc83901850df
- Add license texts to the neon source
Ralf Ertzinger <ralf@skytale.net>
parents:
1722
diff
changeset
|
2 * This program is free software; you can redistribute it and/or modify |
dc83901850df
- Add license texts to the neon source
Ralf Ertzinger <ralf@skytale.net>
parents:
1722
diff
changeset
|
3 * it under the terms of the GNU General Public License as published by |
dc83901850df
- Add license texts to the neon source
Ralf Ertzinger <ralf@skytale.net>
parents:
1722
diff
changeset
|
4 * the Free Software Foundation; either version 2 of the License, or |
dc83901850df
- Add license texts to the neon source
Ralf Ertzinger <ralf@skytale.net>
parents:
1722
diff
changeset
|
5 * (at your option) any later version. |
dc83901850df
- Add license texts to the neon source
Ralf Ertzinger <ralf@skytale.net>
parents:
1722
diff
changeset
|
6 * |
dc83901850df
- Add license texts to the neon source
Ralf Ertzinger <ralf@skytale.net>
parents:
1722
diff
changeset
|
7 * This program is distributed in the hope that it will be useful, |
dc83901850df
- Add license texts to the neon source
Ralf Ertzinger <ralf@skytale.net>
parents:
1722
diff
changeset
|
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
dc83901850df
- Add license texts to the neon source
Ralf Ertzinger <ralf@skytale.net>
parents:
1722
diff
changeset
|
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
dc83901850df
- Add license texts to the neon source
Ralf Ertzinger <ralf@skytale.net>
parents:
1722
diff
changeset
|
10 * GNU General Public License for more details. |
dc83901850df
- Add license texts to the neon source
Ralf Ertzinger <ralf@skytale.net>
parents:
1722
diff
changeset
|
11 * |
dc83901850df
- Add license texts to the neon source
Ralf Ertzinger <ralf@skytale.net>
parents:
1722
diff
changeset
|
12 * You should have received a copy of the GNU General Public License |
dc83901850df
- Add license texts to the neon source
Ralf Ertzinger <ralf@skytale.net>
parents:
1722
diff
changeset
|
13 * along with this program; if not, write to the Free Software |
dc83901850df
- Add license texts to the neon source
Ralf Ertzinger <ralf@skytale.net>
parents:
1722
diff
changeset
|
14 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
dc83901850df
- Add license texts to the neon source
Ralf Ertzinger <ralf@skytale.net>
parents:
1722
diff
changeset
|
15 */ |
dc83901850df
- Add license texts to the neon source
Ralf Ertzinger <ralf@skytale.net>
parents:
1722
diff
changeset
|
16 |
1719
29c35cb8873e
- Add neon HTTP transport plugin sources (for real)
Ralf Ertzinger <ralf@skytale.net>
parents:
diff
changeset
|
17 #ifndef _RB_H |
29c35cb8873e
- Add neon HTTP transport plugin sources (for real)
Ralf Ertzinger <ralf@skytale.net>
parents:
diff
changeset
|
18 #define _RB_H |
29c35cb8873e
- Add neon HTTP transport plugin sources (for real)
Ralf Ertzinger <ralf@skytale.net>
parents:
diff
changeset
|
19 |
29c35cb8873e
- Add neon HTTP transport plugin sources (for real)
Ralf Ertzinger <ralf@skytale.net>
parents:
diff
changeset
|
20 #include <pthread.h> |
29c35cb8873e
- Add neon HTTP transport plugin sources (for real)
Ralf Ertzinger <ralf@skytale.net>
parents:
diff
changeset
|
21 #include <stdlib.h> |
29c35cb8873e
- Add neon HTTP transport plugin sources (for real)
Ralf Ertzinger <ralf@skytale.net>
parents:
diff
changeset
|
22 |
29c35cb8873e
- Add neon HTTP transport plugin sources (for real)
Ralf Ertzinger <ralf@skytale.net>
parents:
diff
changeset
|
23 #ifdef RB_DEBUG |
29c35cb8873e
- Add neon HTTP transport plugin sources (for real)
Ralf Ertzinger <ralf@skytale.net>
parents:
diff
changeset
|
24 #define ASSERT_RB(buf) _assert_rb(buf) |
29c35cb8873e
- Add neon HTTP transport plugin sources (for real)
Ralf Ertzinger <ralf@skytale.net>
parents:
diff
changeset
|
25 #else |
29c35cb8873e
- Add neon HTTP transport plugin sources (for real)
Ralf Ertzinger <ralf@skytale.net>
parents:
diff
changeset
|
26 #define ASSERT_RB(buf) |
29c35cb8873e
- Add neon HTTP transport plugin sources (for real)
Ralf Ertzinger <ralf@skytale.net>
parents:
diff
changeset
|
27 #endif |
29c35cb8873e
- Add neon HTTP transport plugin sources (for real)
Ralf Ertzinger <ralf@skytale.net>
parents:
diff
changeset
|
28 |
29c35cb8873e
- Add neon HTTP transport plugin sources (for real)
Ralf Ertzinger <ralf@skytale.net>
parents:
diff
changeset
|
29 struct ringbuf { |
29c35cb8873e
- Add neon HTTP transport plugin sources (for real)
Ralf Ertzinger <ralf@skytale.net>
parents:
diff
changeset
|
30 pthread_mutex_t lock; |
29c35cb8873e
- Add neon HTTP transport plugin sources (for real)
Ralf Ertzinger <ralf@skytale.net>
parents:
diff
changeset
|
31 char* buf; |
29c35cb8873e
- Add neon HTTP transport plugin sources (for real)
Ralf Ertzinger <ralf@skytale.net>
parents:
diff
changeset
|
32 char* end; |
29c35cb8873e
- Add neon HTTP transport plugin sources (for real)
Ralf Ertzinger <ralf@skytale.net>
parents:
diff
changeset
|
33 char* wp; |
29c35cb8873e
- Add neon HTTP transport plugin sources (for real)
Ralf Ertzinger <ralf@skytale.net>
parents:
diff
changeset
|
34 char* rp; |
29c35cb8873e
- Add neon HTTP transport plugin sources (for real)
Ralf Ertzinger <ralf@skytale.net>
parents:
diff
changeset
|
35 unsigned int free; |
29c35cb8873e
- Add neon HTTP transport plugin sources (for real)
Ralf Ertzinger <ralf@skytale.net>
parents:
diff
changeset
|
36 unsigned int used; |
29c35cb8873e
- Add neon HTTP transport plugin sources (for real)
Ralf Ertzinger <ralf@skytale.net>
parents:
diff
changeset
|
37 unsigned int size; |
29c35cb8873e
- Add neon HTTP transport plugin sources (for real)
Ralf Ertzinger <ralf@skytale.net>
parents:
diff
changeset
|
38 }; |
29c35cb8873e
- Add neon HTTP transport plugin sources (for real)
Ralf Ertzinger <ralf@skytale.net>
parents:
diff
changeset
|
39 |
29c35cb8873e
- Add neon HTTP transport plugin sources (for real)
Ralf Ertzinger <ralf@skytale.net>
parents:
diff
changeset
|
40 int init_rb(struct ringbuf* rb, unsigned int size); |
29c35cb8873e
- Add neon HTTP transport plugin sources (for real)
Ralf Ertzinger <ralf@skytale.net>
parents:
diff
changeset
|
41 int write_rb(struct ringbuf* rb, void* buf, unsigned int size); |
29c35cb8873e
- Add neon HTTP transport plugin sources (for real)
Ralf Ertzinger <ralf@skytale.net>
parents:
diff
changeset
|
42 int read_rb(struct ringbuf* rb, void* buf, unsigned int size); |
29c35cb8873e
- Add neon HTTP transport plugin sources (for real)
Ralf Ertzinger <ralf@skytale.net>
parents:
diff
changeset
|
43 int read_rb_locked(struct ringbuf* rb, void* buf, unsigned int size); |
29c35cb8873e
- Add neon HTTP transport plugin sources (for real)
Ralf Ertzinger <ralf@skytale.net>
parents:
diff
changeset
|
44 void reset_rb(struct ringbuf* rb); |
29c35cb8873e
- Add neon HTTP transport plugin sources (for real)
Ralf Ertzinger <ralf@skytale.net>
parents:
diff
changeset
|
45 unsigned int free_rb(struct ringbuf* rb); |
29c35cb8873e
- Add neon HTTP transport plugin sources (for real)
Ralf Ertzinger <ralf@skytale.net>
parents:
diff
changeset
|
46 unsigned int used_rb(struct ringbuf* rb); |
1722
2e33cfa6a872
- Correct some compiler warnings
Ralf Ertzinger <ralf@skytale.net>
parents:
1719
diff
changeset
|
47 void destroy_rb(struct ringbuf* rb); |
1719
29c35cb8873e
- Add neon HTTP transport plugin sources (for real)
Ralf Ertzinger <ralf@skytale.net>
parents:
diff
changeset
|
48 |
29c35cb8873e
- Add neon HTTP transport plugin sources (for real)
Ralf Ertzinger <ralf@skytale.net>
parents:
diff
changeset
|
49 #endif |