pike.git / src / stralloc.c

version» Context lines:

pike.git/src/stralloc.c:606: Inside #if defined(PIKE_RUN_UNLOCKED)
      /* Now that we have bucket zero, the hash table    * cannot change, go ahead and lock ALL buckets.    * NOTE: bucket zero is already locked    */    for(h=1;h<BUCKET_LOCKS;h++) mt_lock(bucket_locks+h);   #endif       SET_HSIZE( ++hashprimes_entry );    -  base_table=(struct pike_string **)xalloc(sizeof(struct pike_string *)*htable_size); -  MEMSET((char *)base_table,0,sizeof(struct pike_string *)*htable_size); +  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);      #ifdef PIKE_RUN_UNLOCKED
pike.git/src/stralloc.c:2218:       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); -  base_table=(struct pike_string **)xalloc(sizeof(struct pike_string *)*htable_size); -  MEMSET((char *)base_table,0,sizeof(struct pike_string *)*htable_size); +  base_table=xcalloc(sizeof(struct pike_string *), htable_size); +    #ifdef PIKE_RUN_UNLOCKED    {    int h;    bucket_locks=(PIKE_MUTEX_T *)xalloc(sizeof(PIKE_MUTEX_T)*BUCKET_LOCKS);    for(h=0;h<BUCKET_LOCKS;h++) mt_init(bucket_locks + h);    }   #endif    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;