{
int he, i;
- he = a->hash[0] + ((a->hash[1] & 0x0f) << 8);
+ he = a->hash[0] | ((a->hash[1] & 0x0f) << 8);
for(i = 0; i < 4; i++) {
if(!addrcmp(&st->cache[he * 4 + i].a, a))
break;
int he, i;
struct storecache tmp;
- he = a->hash[0] + ((a->hash[1] & 0x0f) << 8);
+ he = a->hash[0] | ((a->hash[1] & 0x0f) << 8);
for(i = 0; i < 4; i++) {
if(!addrcmp(&st->cache[he * 4 + i].a, a))
break;
return;
if(i < 4) {
tmp = st->cache[he * 4 + i];
- memmove(&st->cache[he * 4 + 1], &st->cache[he * 4], i);
+ memmove(&st->cache[he * 4 + 1], &st->cache[he * 4], i * sizeof(struct storecache));
st->cache[he * 4] = tmp;
return;
}
if(st->cache[he * 4 + 3].data != NULL)
free(st->cache[he * 4 + 3].data);
- memmove(&st->cache[he * 4 + 1], &st->cache[he * 4], 3);
+ memmove(&st->cache[he * 4 + 1], &st->cache[he * 4], 3 * sizeof(struct storecache));
st->cache[he * 4].a = *a;
if(len > 0)
st->cache[he * 4].data = memcpy(malloc(len), data, len);