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.158 2003/10/03 12:17:54 grubba Exp $ + || $Id: stralloc.c,v 1.159 2003/10/13 16:23:06 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.158 2003/10/03 12:17:54 grubba Exp $"); + RCSID("$Id: stralloc.c,v 1.159 2003/10/13 16:23:06 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:1391:    if (a->len <= SHORT_STRING_THRESHOLD) {    if (size <= SHORT_STRING_THRESHOLD) {    /* There's already place enough. */    a->len = size;    low_set_index(a, size, 0);    return a;    }    } else if (size > SHORT_STRING_THRESHOLD) {    r=(struct pike_string *)realloc((char *)a,    sizeof(struct pike_string)+ -  ((size+1)<<a->size_shift)); /* FIXME !! */ +  ((size+1)<<a->size_shift));    }       if(!r)    {    r=begin_wide_shared_string(size, a->size_shift);    if (a->len <= size) {    MEMCPY(r->str, a->str, a->len<<a->size_shift);    } else {    MEMCPY(r->str, a->str, size<<a->size_shift);    }