comparison packages/kernel/current/include/mvarimpl.inl @ 2:443894e2e912 ecos-v1_2_1-release

Block commit of eCos version 1.2.1
author jlarmour
date Tue, 11 May 1999 12:24:34 +0000
parents 3111d98ba7b3
children c38311975d4f
comparison
equal deleted inserted replaced
1:72f549f0d891 2:443894e2e912
1 #ifndef CYGONCE_KERNEL_MVARIMPL_INL 1 #ifndef CYGONCE_KERNEL_MVARIMPL_INL
2 #define CYGONCE_KERNEL_MVARIMPL_INL 2 #define CYGONCE_KERNEL_MVARIMPL_INL
3 3
4 //========================================================================== 4 //==========================================================================
5 // 5 //
6 // mvarimpl.inl 6 // mvarimpl.inl
7 // 7 //
8 // Memory pool with variable block class declarations 8 // Memory pool with variable block class declarations
9 // 9 //
10 //========================================================================== 10 //==========================================================================
11 //####COPYRIGHTBEGIN#### 11 //####COPYRIGHTBEGIN####
12 // 12 //
13 // ------------------------------------------- 13 // -------------------------------------------
23 // 23 //
24 // The Original Code is eCos - Embedded Cygnus Operating System, released 24 // The Original Code is eCos - Embedded Cygnus Operating System, released
25 // September 30, 1998. 25 // September 30, 1998.
26 // 26 //
27 // The Initial Developer of the Original Code is Cygnus. Portions created 27 // The Initial Developer of the Original Code is Cygnus. Portions created
28 // by Cygnus are Copyright (C) 1998 Cygnus Solutions. All Rights Reserved. 28 // by Cygnus are Copyright (C) 1998,1999 Cygnus Solutions. All Rights Reserved.
29 // ------------------------------------------- 29 // -------------------------------------------
30 // 30 //
31 //####COPYRIGHTEND#### 31 //####COPYRIGHTEND####
32 //========================================================================== 32 //==========================================================================
33 //#####DESCRIPTIONBEGIN#### 33 //#####DESCRIPTIONBEGIN####
34 // 34 //
35 // Author(s): hmt 35 // Author(s): hmt
36 // Contributors: hmt 36 // Contributors: hmt
37 // Date: 1998-03-23 37 // Date: 1998-03-23
38 // Purpose: Define Mvarimpl class interface 38 // Purpose: Define Mvarimpl class interface
39 // Description: Inline class for constructing a variable block allocator 39 // Description: Inline class for constructing a variable block allocator
40 // Usage: #include <cyg/kernel/mvarimpl.hxx> 40 // Usage: #include <cyg/kernel/mvarimpl.hxx>
41 // #include <cyg/kernel/mvarimpl.inl> 41 // #include <cyg/kernel/mvarimpl.inl>
42 // 42 //
43 //####DESCRIPTIONEND#### 43 //####DESCRIPTIONEND####
44 // 44 //
45 //========================================================================== 45 //==========================================================================
46 46
192 #ifdef CYGSEM_KERNEL_MEMORY_COALESCE 192 #ifdef CYGSEM_KERNEL_MEMORY_COALESCE
193 // For simple coalescing have the free list be sorted by memory base address 193 // For simple coalescing have the free list be sorted by memory base address
194 struct memdq *idq; 194 struct memdq *idq;
195 195
196 for (idq = hdq->next; idq != hdq; idq = idq->next) { 196 for (idq = hdq->next; idq != hdq; idq = idq->next) {
197 if (idq < dq) 197 if (idq->next > dq)
198 break; 198 break;
199 } 199 }
200 dq->size = size; 200 dq->size = size;
201 if (idq != hdq) { 201 if (idq != hdq) {
202 dq->prev = idq; 202 dq->prev = idq;
203 dq->next = idq->next; 203 dq->next = idq->next;
204 idq->next = dq; 204 idq->next = dq;
205 dq->next->prev = dq; 205 dq->next->prev = dq;
206 } else { 206 } else {
207 dq->next = idq; 207 dq->next = idq;
208 dq->prev = idq->prev; 208 dq->prev = idq->prev;
209 idq->prev = dq; 209 idq->prev = dq;
210 dq->prev->next = dq; 210 dq->prev->next = dq;
211 } 211 }
212 // Now do coalescing 212 // Now do coalescing
213 if ((char *)dq + dq->size == (char *)dq->next) { 213 if ((char *)dq + dq->size == (char *)dq->next) {
214 dq->size += dq->next->size; 214 dq->size += dq->next->size;
215 dq->next = dq->next->next; 215 dq->next = dq->next->next;
216 dq->next->prev = dq; 216 dq->next->prev = dq;
217 } 217 }
218 if ((char *)dq->prev + dq->prev->size == (char *)dq) { 218 if ((char *)dq->prev + dq->prev->size == (char *)dq) {
219 dq->prev->size += dq->size; 219 dq->prev->size += dq->size;
220 dq->prev->next = dq->next; 220 dq->prev->next = dq->next;
221 dq->next->prev = dq->prev; 221 dq->next->prev = dq->prev;
222 dq = dq->prev; 222 dq = dq->prev;
223 } 223 }
224 #else 224 #else
225 dq->prev = hdq; 225 dq->prev = hdq;
226 dq->next = hdq->next; 226 dq->next = hdq->next;
227 dq->size = size; 227 dq->size = size;