pike.git / src / stralloc.c

version» Context lines:

pike.git/src/stralloc.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: stralloc.c,v 1.159 2003/10/13 16:23:06 mast Exp $ + || $Id: stralloc.c,v 1.160 2003/11/09 01:10:14 mast Exp $   */      #include "global.h"   #include "stralloc.h"   #include "pike_macros.h"   #include "dynamic_buffer.h"   #include "pike_macros.h"   #include "pike_memory.h"   #include "pike_error.h"   #include "gc.h"
pike.git/src/stralloc.c:17:   #include "bignum.h"   #include "interpret.h"   #include "block_alloc.h"   #include "operators.h"      #include <errno.h>   #include <float.h>   #include <ctype.h>   #include <math.h>    - RCSID("$Id: stralloc.c,v 1.159 2003/10/13 16:23:06 mast Exp $"); + RCSID("$Id: stralloc.c,v 1.160 2003/11/09 01:10:14 mast Exp $");      /* #define STRALLOC_USE_PRIMES */      #ifdef STRALLOC_USE_PRIMES      #define SET_HSIZE(X) htable_size=hashprimes[(X)]   #define HMODULO(X) ((X) % htable_size)      #else   
pike.git/src/stralloc.c:976:    if(!sub_ref(s))    really_free_string(s);   }         /*    * String table status    */   struct pike_string *add_string_status(int verbose)   { +  dynamic_buffer save_buf;    char b[200];    -  init_buf(); +  init_buf(&save_buf);       if (verbose)    {    int allocd_strings=0;    int allocd_bytes=0;    int num_distinct_strings=0;    int bytes_distinct_strings=0;    ptrdiff_t overhead_bytes = 0;    unsigned INT32 e;    struct pike_string *p;
pike.git/src/stralloc.c:1023:    sprintf(b, "Space actually required/total string bytes %ld%%\n",    DO_NOT_WARN((long)((bytes_distinct_strings + overhead_bytes)*100 /    allocd_bytes)));    my_strcat(b);    }   /*    sprintf(b,"Searches: %ld Average search length: %6.3f\n",    (long)num_str_searches, (double)search_len / num_str_searches);    my_strcat(b);   */ -  return free_buf(); +  return free_buf(&save_buf);   }      /*** PIKE_DEBUG ***/   #ifdef PIKE_DEBUG      static long last_stralloc_verify=0;   extern long current_do_debug_cycle;      PMOD_EXPORT void check_string(struct pike_string *s)   {
pike.git/src/stralloc.c:1810:    base_table=(struct pike_string **)xalloc(sizeof(struct pike_string *)*htable_size);    MEMSET((char *)base_table,0,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(""); -  -  initialize_global_buf(); +    }      #ifdef DEBUG_MALLOC   struct shared_string_location *all_shared_string_locations;   #endif         void cleanup_shared_string_table(void)   {    unsigned INT32 e;