pike.git / src / stralloc.c

version» Context lines:

pike.git/src/stralloc.c:690:    low_set_index(t,len,0);    return t;   }      static struct pike_string * make_static_string(const char * str, size_t len,    enum size_shift shift)   {    struct pike_string * t = ba_alloc(&string_allocator);   #ifdef PIKE_DEBUG    gc_init_marker(t); +  if (generic_extract(str, shift, len)) { +  Pike_fatal("Static string \"%.*s\" is not NUL-terminated!\n", len, str); +  }   #endif    t->flags = STRING_NOT_HASHED|STRING_NOT_SHARED;    t->size_shift = shift;    t->alloc_type = STRING_ALLOC_STATIC;    t->struct_type = STRING_STRUCT_STRING;    t->str = (char *)str;    t->refs = 0;    t->len = len;    add_ref(t); /* For DMALLOC */       return t;   }      PMOD_EXPORT struct pike_string * make_shared_static_string(const char *str, size_t len,    enum size_shift shift)   {    struct pike_string *s;    ptrdiff_t h = StrHash(str, len);    -  + #ifdef PIKE_DEBUG +  if (generic_extract(str, shift, len)) { +  Pike_fatal("Static string \"%.*s\" is not NUL-terminated!\n", len, str); +  } + #endif +     s = internal_findstring(str,len,shift,h);       if (!s) {    s = make_static_string(str, len, shift);    link_pike_string(s, h);    } else {    /* NB: The following is only possible if there are no substring references    * to the old string.    */    if (!(s->flags & STRING_IS_LOCKED) && !string_is_static(s))