pike.git / src / stralloc.c

version» Context lines:

pike.git/src/stralloc.c:17:   #include "interpret.h"   #include "operators.h"   #include "pike_float.h"   #include "block_allocator.h"      #include <errno.h>   #include <float.h>   #include <ctype.h>   #include <math.h>    - #define SET_HSIZE(X) htable_mask=(htable_size=(1<<(X)))-1 + #define SET_HSIZE(X) htable_mask=(htable_size=(X))-1   #define HMODULO(X) ((X) & (htable_mask))      static unsigned INT32 htable_mask;      #if (SIZEOF_LONG == 4) && defined(_LP64)   /* Kludge for gcc and the system header files not using the same model... */   #undef LONG_MIN   #undef LONG_MAX   #undef ULONG_MAX   #define LONG_MIN INT_MIN
pike.git/src/stralloc.c:41:      #define BEGIN_HASH_SIZE 1024      static unsigned int hash_prefix_len=64;   static unsigned int need_more_hash_prefix_depth=0;      static unsigned int need_new_hashkey_depth=0;   static size_t hashkey = 0;      static unsigned INT32 htable_size=0; - static unsigned int hashprimes_entry=0; +    static struct pike_string **base_table=0;   static unsigned INT32 num_strings=0;   PMOD_EXPORT struct pike_string *empty_pike_string = 0;      /*** Main string hash function ***/      #define StrHash(s,len) low_do_hash(s,len,0)   #define low_do_hash(STR,LEN,SHIFT) low_hashmem( (STR), (LEN)<<(SHIFT), hash_prefix_len<<(SHIFT), hashkey )   #define do_hash(STR) low_do_hash(STR->str,STR->len,STR->size_shift)   
pike.git/src/stralloc.c:601:   }      static void stralloc_rehash(void)   {    int h,old;    struct pike_string **old_base;       old=htable_size;    old_base=base_table;    -  SET_HSIZE( ++hashprimes_entry ); +  SET_HSIZE(htable_size<<1);       base_table=xcalloc(sizeof(struct pike_string *), htable_size);       need_more_hash_prefix_depth = 0;       for(h=0;h<old;h++)    rehash_string_backwards(old_base[h]);       if(old_base)    free(old_base);
pike.git/src/stralloc.c:2127:    }    generic_memcpy(r,MKPCHARP(s,str->size_shift),(end-s)>>str->size_shift);       CALL_AND_UNSET_ONERROR (mojt_uwp);    return end_shared_string(ret);   }      /*** init/exit memory ***/   void init_shared_string_table(void)   { -  for(hashprimes_entry=0;hashprimes[hashprimes_entry]<BEGIN_HASH_SIZE;hashprimes_entry++); -  SET_HSIZE(hashprimes_entry); +  SET_HSIZE(BEGIN_HASH_SIZE);    base_table=xcalloc(sizeof(struct pike_string *), htable_size);       empty_pike_string = make_shared_string("");    empty_pike_string->flags |= STRING_CONTENT_CHECKED | STRING_IS_LOWERCASE | STRING_IS_UPPERCASE;    empty_pike_string->min = empty_pike_string->max = 0;   }      #ifdef DO_PIKE_CLEANUP   PMOD_EXPORT struct shared_string_location *all_shared_string_locations;   #endif