convert entry * to int8_t before substracting pointers
This commit is contained in:
parent
a876e9d6c8
commit
4fa6d2b648
|
|
@ -291,7 +291,7 @@ void * f_cache_get_key(struct FifoCache *cache,const void *entry)
|
||||||
if(entry<(const void *)cache->e_head || entry>=(const void *)cache->e_stop)
|
if(entry<(const void *)cache->e_head || entry>=(const void *)cache->e_stop)
|
||||||
return NULL;
|
return NULL;
|
||||||
/* find cache index */
|
/* find cache index */
|
||||||
i=(entry-cache->e_head)/cache->entrysize;
|
i=((int8_t *)entry-cache->e_head)/cache->entrysize;
|
||||||
return cache->k_head+cache->keysize*i;
|
return cache->k_head+cache->keysize*i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -311,7 +311,7 @@ int f_cache_delete_entry(struct FifoCache *cache, void *entry)
|
||||||
/* check if pointer is good */
|
/* check if pointer is good */
|
||||||
if(entry<(const void *)cache->e_head || entry>=(const void *)cache->e_stop) return 0;
|
if(entry<(const void *)cache->e_head || entry>=(const void *)cache->e_stop) return 0;
|
||||||
/* find cache index */
|
/* find cache index */
|
||||||
i=(entry-cache->e_head)/cache->entrysize;
|
i=((int8_t *)entry-cache->e_head)/cache->entrysize;
|
||||||
|
|
||||||
/* deallocate */
|
/* deallocate */
|
||||||
if(cache->k_destroy_func) cache->k_destroy_func(cache->k_head+cache->keysize*i);
|
if(cache->k_destroy_func) cache->k_destroy_func(cache->k_head+cache->keysize*i);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user