pike.git / src / stralloc.c

version» Context lines:

pike.git/src/stralloc.c:19:      #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.121 2001/09/28 23:14:09 hubbe Exp $"); + RCSID("$Id: stralloc.c,v 1.122 2008/11/05 15:04:25 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:638:    return low_end_shared_string(s);   }      PMOD_EXPORT struct pike_string *end_and_resize_shared_string(struct pike_string *str, ptrdiff_t len)   {    struct pike_string *tmp;   #ifdef PIKE_DEBUG    if(len > str->len)    fatal("Cannot extend string here!\n");   #endif -  if( str->len <= SHORT_STRING_THRESHOLD ? -  (len <= SHORT_STRING_THRESHOLD) : -  (len > SHORT_STRING_THRESHOLD) && str->len > len/2 ) +  if( (str->len <= SHORT_STRING_THRESHOLD) || +  ((len > SHORT_STRING_THRESHOLD) && (str->len <= (len<<1))) )    {    str->len=len; -  str->str[len]=0; +  SET_INDEX_PCHARP(MKPCHARP_STR(str), len, 0);    return end_shared_string(str);    }    tmp = make_shared_binary_pcharp(MKPCHARP_STR(str),len);    really_free_pike_string(str);    return tmp;   }         PMOD_EXPORT struct pike_string * debug_make_shared_binary_string(const char *str,size_t len)   {