pike.git / src / stralloc.c

version» Context lines:

pike.git/src/stralloc.c:18:      #include <errno.h>   #include <float.h>   #include <ctype.h>   #include <math.h>      #ifndef HUGE   #define HUGE HUGE_VAL   #endif /*!HUGE*/    - RCSID("$Id: stralloc.c,v 1.82 2000/04/15 05:05:28 hubbe Exp $"); + RCSID("$Id: stralloc.c,v 1.83 2000/06/27 15:24:34 grubba Exp $");      #define BEGIN_HASH_SIZE 997   #define MAX_AVG_LINK_LENGTH 3      /* Experimental dynamic hash length */   #ifndef HASH_PREFIX   static unsigned int HASH_PREFIX=64;   static unsigned int need_more_hash_prefix=0;   #endif   
pike.git/src/stralloc.c:589:    {    case 0:    return make_shared_binary_string((char *)(str.ptr), len);    case 1:    return make_shared_binary_string1((p_wchar1 *)(str.ptr), len);    case 2:    return make_shared_binary_string2((p_wchar2 *)(str.ptr), len);    default:    fatal("Unknown string width!\n");    } +  /* NOT REACHED */ +  return NULL; /* Keep the compiler happy */   }      struct pike_string * debug_make_shared_pcharp(const PCHARP str)   {    return debug_make_shared_binary_pcharp(str, pcharp_strlen(str));   }      struct pike_string * debug_make_shared_binary_string0(const p_wchar0 *str,int len)   {    return debug_make_shared_binary_string((const char *)str, len);
pike.git/src/stralloc.c:710:      void do_free_string(struct pike_string *s)   {    free_string(s);   }      void really_free_string(struct pike_string *s)   {   #ifdef PIKE_DEBUG    extern int d_flag; +  if (d_flag) { +  if (s->refs) { +  fatal("Freeing string with references!\n"); +  }    if(d_flag > 2)    {    if(s->next == (struct pike_string *)-1)    fatal("Freeing shared string again!\n");       if(((long)s->next) & 1)    fatal("Freeing shared string again, memory corrupt or other bug!\n");    } -  +  }   #endif    unlink_pike_string(s);    debug_free((char *)s,DMALLOC_LOCATION(),1);   }      void debug_free_string(struct pike_string *s)   {    if(--s->refs<=0)    really_free_string(s);   }