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.176 2010/09/29 09:46:30 grubba Exp $ + || $Id$   */      #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.176 2010/09/29 09:46:30 grubba Exp $"); + #ifndef HUGE + #define HUGE HUGE_VAL + #endif /*!HUGE*/    -  + RCSID("$Id$"); +    /* #define STRALLOC_USE_PRIMES */      #ifdef STRALLOC_USE_PRIMES      #define SET_HSIZE(X) htable_size=hashprimes[(X)]   #define HMODULO(X) ((X) % htable_size)      #else      #define SET_HSIZE(X) htable_mask=(htable_size=(1<<(X)))-1
pike.git/src/stralloc.c:946:    INT32 len;    for(len=0;str[len];len++);    return debug_make_shared_binary_string2(str,len);   }      /*** Free strings ***/      PMOD_EXPORT void unlink_pike_string(struct pike_string *s)   {    size_t h; +  struct pike_string *found;    LOCK_BUCKET(s->hval);    h= HMODULO(s->hval); -  propagate_shared_string(s,h); +  found = propagate_shared_string(s,h);   #ifdef PIKE_DEBUG -  if (base_table[h] != s) { +  if (found != s) { +  /* Note: Code backported from Pike 7.8 may trigger this +  * since in Pike 7.8 it's ok to call free_string() +  * with strings that haven't been ended yet. +  */ +  Pike_fatal("propagate_shared_string() failed. String not found.\n" +  "free_string() called with unshared string?\n"); +  } else if (base_table[h] != s) {    Pike_fatal("propagate_shared_string() failed. Probably got bogus pike_string.\n");    }   #endif /* PIKE_DEBUG */    base_table[h]=s->next;   #ifdef PIKE_DEBUG    s->next=(struct pike_string *)(ptrdiff_t)-1;   #endif    num_strings--;    UNLOCK_BUCKET(s->hval);   }