summaryrefslogtreecommitdiffabout
path: root/libical
authorzautrix <zautrix>2005-07-04 19:16:55 (UTC)
committer zautrix <zautrix>2005-07-04 19:16:55 (UTC)
commit4f3238355f67a256f338986ca13322ef23960895 (patch) (unidiff)
tree023eabaf2c42d2c58753e5a3f9c5c680f132fbf8 /libical
parentb0ed0793fa5d27475d8954a683ea68ca9ac0017f (diff)
downloadkdepimpi-4f3238355f67a256f338986ca13322ef23960895.zip
kdepimpi-4f3238355f67a256f338986ca13322ef23960895.tar.gz
kdepimpi-4f3238355f67a256f338986ca13322ef23960895.tar.bz2
free ring buffer
Diffstat (limited to 'libical') (more/less context) (ignore whitespace changes)
-rw-r--r--libical/src/libical/icalmemory.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libical/src/libical/icalmemory.c b/libical/src/libical/icalmemory.c
index 058ef37..18d7ef9 100644
--- a/libical/src/libical/icalmemory.c
+++ b/libical/src/libical/icalmemory.c
@@ -64,18 +64,18 @@
64#include <stdio.h> /* for printf (debugging) */ 64#include <stdio.h> /* for printf (debugging) */
65#include <stdlib.h> /* for malloc, realloc */ 65#include <stdlib.h> /* for malloc, realloc */
66#include <string.h> /* for memset(), strdup */ 66#include <string.h> /* for memset(), strdup */
67 67
68#ifdef WIN32 68#ifdef WIN32
69#include <windows.h> 69#include <windows.h>
70#endif 70#endif
71 71
72#define BUFFER_RING_SIZE 2500 72#define BUFFER_RING_SIZE 50
73#define MIN_BUFFER_SIZE 200 73#define MIN_BUFFER_SIZE 64
74 74
75 75
76/* HACK. Not threadsafe */ 76/* HACK. Not threadsafe */
77 77
78typedef struct { 78typedef struct {
79 int pos; 79 int pos;
80 void *ring[BUFFER_RING_SIZE]; 80 void *ring[BUFFER_RING_SIZE];
81} buffer_ring; 81} buffer_ring;
@@ -208,18 +208,19 @@ void icalmemory_free_ring_byval(buffer_ring *br) {
208 } 208 }
209 free(br); 209 free(br);
210} 210}
211 211
212void icalmemory_free_ring() 212void icalmemory_free_ring()
213{ 213{
214 buffer_ring *br; 214 buffer_ring *br;
215 br = get_buffer_ring(); 215 br = get_buffer_ring();
216
217 icalmemory_free_ring_byval(br); 216 icalmemory_free_ring_byval(br);
217 if ( global_buffer_ring == br )
218 global_buffer_ring = 0;
218} 219}
219 220
220 221
221 222
222/** Like strdup, but the buffer is on the ring. */ 223/** Like strdup, but the buffer is on the ring. */
223char* 224char*
224icalmemory_tmp_copy(const char* str) 225icalmemory_tmp_copy(const char* str)
225{ 226{