4 |
/* */ |
/* */ |
5 |
/* Simple MRU list-cache (specification). */ |
/* Simple MRU list-cache (specification). */ |
6 |
/* */ |
/* */ |
7 |
/* Copyright 2000-2001, 2003, 2004 by */ |
/* Copyright 2000-2001, 2003, 2004, 2005 by */ |
8 |
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
9 |
/* */ |
/* */ |
10 |
/* This file is part of the FreeType project, and may only be used, */ |
/* This file is part of the FreeType project, and may only be used, */ |
172 |
FT_BEGIN_STMNT \ |
FT_BEGIN_STMNT \ |
173 |
FTC_MruNode* _pfirst = &(list)->nodes; \ |
FTC_MruNode* _pfirst = &(list)->nodes; \ |
174 |
FTC_MruNode_CompareFunc _compare = (FTC_MruNode_CompareFunc)(compare); \ |
FTC_MruNode_CompareFunc _compare = (FTC_MruNode_CompareFunc)(compare); \ |
175 |
FTC_MruNode _first, _node; \ |
FTC_MruNode _first, _node, *_pnode; \ |
176 |
\ |
\ |
177 |
\ |
\ |
178 |
error = 0; \ |
error = 0; \ |
179 |
_first = *(_pfirst); \ |
_first = *(_pfirst); \ |
180 |
_node = NULL; \ |
_node = NULL; \ |
181 |
\ |
\ |
182 |
if ( _first ) \ |
if ( _first ) \ |
183 |
{ \ |
{ \ |
184 |
_node = _first; \ |
_node = _first; \ |
185 |
do \ |
do \ |
186 |
{ \ |
{ \ |
187 |
if ( _compare( _node, (key) ) ) \ |
if ( _compare( _node, (key) ) ) \ |
188 |
{ \ |
{ \ |
189 |
if ( _node != _first ) \ |
if ( _node != _first ) \ |
190 |
FTC_MruNode_Up( _pfirst, _node ); \ |
FTC_MruNode_Up( _pfirst, _node ); \ |
191 |
\ |
\ |
192 |
*(FTC_MruNode*)&(node) = _node; \ |
_pnode = (FTC_MruNode*)(void*)&(node); \ |
193 |
goto _MruOk; \ |
*_pnode = _node; \ |
194 |
} \ |
goto _MruOk; \ |
195 |
_node = _node->next; \ |
} \ |
196 |
\ |
_node = _node->next; \ |
197 |
} while ( _node != _first) ; \ |
\ |
198 |
} \ |
} while ( _node != _first) ; \ |
199 |
\ |
} \ |
200 |
error = FTC_MruList_New( (list), (key), (FTC_MruNode*)&(node) ); \ |
\ |
201 |
_MruOk: \ |
error = FTC_MruList_New( (list), (key), (FTC_MruNode*)(void*)&(node) ); \ |
202 |
; \ |
_MruOk: \ |
203 |
|
; \ |
204 |
FT_END_STMNT |
FT_END_STMNT |
205 |
|
|
206 |
#define FTC_MRULIST_LOOKUP( list, key, node, error ) \ |
#define FTC_MRULIST_LOOKUP( list, key, node, error ) \ |