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.232 2008/11/05 12:09:36 grubba Exp $ + || $Id: stralloc.c,v 1.233 2008/11/05 15:03:39 grubba 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:891:    Pike_fatal("Cannot extend string here!\n");   #endif    if( (str->len <= SHORT_STRING_THRESHOLD) ||    ((len > SHORT_STRING_THRESHOLD) && (str->len <= (len<<1))) )    {    /* Short string before and after or    * long string and at least half the length of the buffer.    *    * NOTE: We lose track of the actual buffer length here, so don't    * use this function to shorten a string in decrements. -  * -  * FIXME: Wide strings get only a partial NUL-termination. +     */    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);    free_string(str);    return tmp;   }         PMOD_EXPORT struct pike_string * debug_make_shared_binary_string(const char *str,size_t len)   {