39 |
void |
void |
40 |
cache_remove_lru_bitmap(uint8 cache_id) |
cache_remove_lru_bitmap(uint8 cache_id) |
41 |
{ |
{ |
42 |
int i; |
uint32 i; |
43 |
uint16 cache_idx = 0; |
uint16 cache_idx = 0; |
44 |
uint32 m = 0xffffffff; |
uint32 m = 0xffffffff; |
45 |
BMPCACHEENTRY *pbce; |
BMPCACHEENTRY *pbce; |
125 |
void |
void |
126 |
cache_save_state(void) |
cache_save_state(void) |
127 |
{ |
{ |
128 |
int id, idx; |
uint32 id, idx; |
129 |
|
|
130 |
for (id = 0; id < NUM_ELEMENTS(g_bmpcache); id++) |
for (id = 0; id < NUM_ELEMENTS(g_bmpcache); id++) |
131 |
if (IS_PERSISTENT(id)) |
if (IS_PERSISTENT(id)) |
189 |
{ |
{ |
190 |
DATABLOB *text; |
DATABLOB *text; |
191 |
|
|
192 |
if (cache_id < NUM_ELEMENTS(g_textcache)) |
text = &g_textcache[cache_id]; |
193 |
{ |
return text; |
|
text = &g_textcache[cache_id]; |
|
|
if (text->data != NULL) |
|
|
return text; |
|
|
} |
|
|
|
|
|
error("get text %d\n", cache_id); |
|
|
return NULL; |
|
194 |
} |
} |
195 |
|
|
196 |
/* Store a text item in the cache */ |
/* Store a text item in the cache */ |
199 |
{ |
{ |
200 |
DATABLOB *text; |
DATABLOB *text; |
201 |
|
|
202 |
if (cache_id < NUM_ELEMENTS(g_textcache)) |
text = &g_textcache[cache_id]; |
203 |
{ |
if (text->data != NULL) |
204 |
text = &g_textcache[cache_id]; |
xfree(text->data); |
205 |
if (text->data != NULL) |
text->data = xmalloc(length); |
206 |
xfree(text->data); |
text->size = length; |
207 |
|
memcpy(text->data, data, length); |
|
text->data = xmalloc(length); |
|
|
text->size = length; |
|
|
memcpy(text->data, data, length); |
|
|
} |
|
|
else |
|
|
{ |
|
|
error("put text %d\n", cache_id); |
|
|
} |
|
208 |
} |
} |
209 |
|
|
210 |
|
|