diff options
author | Mike Buland <eichlan@xagasoft.com> | 2007-06-05 18:46:01 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2007-06-05 18:46:01 +0000 |
commit | 8c2c728ce5aa1c1941426d0f8e9ab27762ef6754 (patch) | |
tree | 29568db8f979596341b0cdf8f0c25d9a78a48b7d /src/list.h | |
parent | b7e40536df9bf9bbad3b2b7a59f33ebad25fc981 (diff) | |
download | libbu++-8c2c728ce5aa1c1941426d0f8e9ab27762ef6754.tar.gz libbu++-8c2c728ce5aa1c1941426d0f8e9ab27762ef6754.tar.bz2 libbu++-8c2c728ce5aa1c1941426d0f8e9ab27762ef6754.tar.xz libbu++-8c2c728ce5aa1c1941426d0f8e9ab27762ef6754.zip |
Added a basic ringbuffer, it should be nice and quick, but may be bad to use
with objects at the moment, still contemplating that one...
Diffstat (limited to 'src/list.h')
-rw-r--r-- | src/list.h | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -69,10 +69,10 @@ namespace Bu | |||
69 | { | 69 | { |
70 | if( pCur == NULL ) break; | 70 | if( pCur == NULL ) break; |
71 | va.destroy( pCur->pValue ); | 71 | va.destroy( pCur->pValue ); |
72 | va.deallocate( pCur->pValue, sizeof( value ) ); | 72 | va.deallocate( pCur->pValue, 1 ); |
73 | Link *pTmp = pCur->pNext; | 73 | Link *pTmp = pCur->pNext; |
74 | la.destroy( pCur ); | 74 | la.destroy( pCur ); |
75 | la.deallocate( pCur, sizeof( Link ) ); | 75 | la.deallocate( pCur, 1 ); |
76 | pCur = pTmp; | 76 | pCur = pTmp; |
77 | } | 77 | } |
78 | pFirst = pLast = NULL; | 78 | pFirst = pLast = NULL; |
@@ -81,8 +81,8 @@ namespace Bu | |||
81 | 81 | ||
82 | void append( const value &v ) | 82 | void append( const value &v ) |
83 | { | 83 | { |
84 | Link *pNew = la.allocate( sizeof( Link ) ); | 84 | Link *pNew = la.allocate( 1 ); |
85 | pNew->pValue = va.allocate( sizeof( value ) ); | 85 | pNew->pValue = va.allocate( 1 ); |
86 | va.construct( pNew->pValue, v ); | 86 | va.construct( pNew->pValue, v ); |
87 | nSize++; | 87 | nSize++; |
88 | if( pFirst == NULL ) | 88 | if( pFirst == NULL ) |
@@ -102,8 +102,8 @@ namespace Bu | |||
102 | 102 | ||
103 | void prepend( const value &v ) | 103 | void prepend( const value &v ) |
104 | { | 104 | { |
105 | Link *pNew = la.allocate( sizeof( Link ) ); | 105 | Link *pNew = la.allocate( 1 ); |
106 | pNew->pValue = va.allocate( sizeof( value ) ); | 106 | pNew->pValue = va.allocate( 1 ); |
107 | va.construct( pNew->pValue, v ); | 107 | va.construct( pNew->pValue, v ); |
108 | nSize++; | 108 | nSize++; |
109 | if( pFirst == NULL ) | 109 | if( pFirst == NULL ) |
@@ -316,10 +316,10 @@ namespace Bu | |||
316 | if( pPrev == NULL ) | 316 | if( pPrev == NULL ) |
317 | { | 317 | { |
318 | va.destroy( pCur->pValue ); | 318 | va.destroy( pCur->pValue ); |
319 | va.deallocate( pCur->pValue, sizeof( value ) ); | 319 | va.deallocate( pCur->pValue, 1 ); |
320 | pFirst = pCur->pNext; | 320 | pFirst = pCur->pNext; |
321 | la.destroy( pCur ); | 321 | la.destroy( pCur ); |
322 | la.deallocate( pCur, sizeof( Link ) ); | 322 | la.deallocate( pCur, 1 ); |
323 | if( pFirst == NULL ) | 323 | if( pFirst == NULL ) |
324 | pLast = NULL; | 324 | pLast = NULL; |
325 | nSize--; | 325 | nSize--; |
@@ -328,10 +328,10 @@ namespace Bu | |||
328 | else | 328 | else |
329 | { | 329 | { |
330 | va.destroy( pCur->pValue ); | 330 | va.destroy( pCur->pValue ); |
331 | va.deallocate( pCur->pValue, sizeof( value ) ); | 331 | va.deallocate( pCur->pValue, 1 ); |
332 | Link *pTmp = pCur->pNext; | 332 | Link *pTmp = pCur->pNext; |
333 | la.destroy( pCur ); | 333 | la.destroy( pCur ); |
334 | la.deallocate( pCur, sizeof( Link ) ); | 334 | la.deallocate( pCur, 1 ); |
335 | pPrev->pNext = pTmp; | 335 | pPrev->pNext = pTmp; |
336 | if( pTmp != NULL ) | 336 | if( pTmp != NULL ) |
337 | pTmp->pPrev = pPrev; | 337 | pTmp->pPrev = pPrev; |