}
#define LRU_DEL( c, e ) do { \
- if ( e == (c)->c_lruhead ) (c)->c_lruhead = e->bei_lruprev; \
- if ( e == (c)->c_lrutail ) (c)->c_lrutail = e->bei_lruprev; \
- e->bei_lrunext->bei_lruprev = e->bei_lruprev; \
- e->bei_lruprev->bei_lrunext = e->bei_lrunext; \
+ if ( e == e->bei_lruprev ) { \
+ (c)->c_lruhead = (c)->c_lrutail = NULL; \
+ } else { \
+ if ( e == (c)->c_lruhead ) (c)->c_lruhead = e->bei_lruprev; \
+ if ( e == (c)->c_lrutail ) (c)->c_lrutail = e->bei_lruprev; \
+ e->bei_lrunext->bei_lruprev = e->bei_lruprev; \
+ e->bei_lruprev->bei_lrunext = e->bei_lrunext; \
+ } \
e->bei_lruprev = NULL; \
} while ( 0 )