// ------------------------------- crc32 --------------------------------------
-static unsigned int*crc32 = 0;
+static unsigned int crc32[256];
+static char crc32_initialized=0;
static void crc32_init(void)
{
int t;
- if(crc32)
+ if(crc32_initialized)
return;
- crc32= (unsigned int*)rfx_alloc(sizeof(unsigned int)*256);
+ crc32_initialized = 1;
for(t=0; t<256; t++) {
unsigned int c = t;
int s;
unsigned int crc32_add_byte(unsigned int checksum, unsigned char b)
{
- if(!crc32)
- crc32_init();
+ crc32_init();
return checksum>>8 ^ crc32[(b^checksum)&0xff];
}
unsigned int crc32_add_string(unsigned int checksum, const char*s)
{
- if(!crc32)
- crc32_init();
+ crc32_init();
if(!s)
return checksum;
while(*s) {
{
int t;
unsigned int checksum = 0;
- if(!crc32)
- crc32_init();
+ crc32_init();
for(t=0;t<str->len;t++) {
checksum = checksum>>8 ^ crc32[(str->str[t]^checksum)&0xff];
}
{
unsigned int checksum = 0;
const char*p = str;
- if(!crc32)
- crc32_init();
+ crc32_init();
while(*p) {
checksum = checksum>>8 ^ crc32[(*p^checksum)&0xff];
p++;
while(e) {
if(h->key_type->equals(e->key, key)) {
dictentry_t*next = e->next;
- rfx_free((void*)e->key);
+ h->key_type->free(e->key);
memset(e, 0, sizeof(dictentry_t));
rfx_free(e);
if(e == head) {