pike.git / src / stralloc.c

version» Context lines:

pike.git/src/stralloc.c:654:    verify_shared_strings_tables();   #endif   #ifdef PIKE_DEBUG    if (shift > 2)    Pike_fatal("Unsupported string shift: %d\n", shift);   #endif /* PIKE_DEBUG */    t=ba_alloc(&string_allocator);    /* we mark the string as static here, to avoid double free if the    * allocations fail    */ + #ifdef PIKE_DEBUG +  gc_init_marker(&t->m); + #endif    t->flags = STRING_NOT_HASHED|STRING_NOT_SHARED;    t->alloc_type = STRING_ALLOC_STATIC;    t->struct_type = STRING_STRUCT_STRING;    SET_ONERROR(fe,free_unlinked_pike_string,t);    if (bytes <= sizeof(struct pike_string))    {    t->str = ba_alloc(&string_allocator);    t->alloc_type = STRING_ALLOC_BA;    } else {    t->str = xalloc(bytes);
pike.git/src/stralloc.c:680:    DO_IF_DEBUG(t->next = NULL);    UNSET_ONERROR(fe);    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->m); + #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;
pike.git/src/stralloc.c:730:   PMOD_EXPORT struct pike_string * make_shared_malloc_string(char *str, size_t len,    enum size_shift shift)   {    struct pike_string *s;    ptrdiff_t h = StrHash(str, len);       s = internal_findstring(str,len,shift,h);       if (!s) {    s = ba_alloc(&string_allocator); + #ifdef PIKE_DEBUG +  gc_init_marker(&s->m); + #endif       s->flags = STRING_NOT_HASHED|STRING_NOT_SHARED;    s->size_shift = shift;    s->alloc_type = STRING_ALLOC_MALLOC;    s->struct_type = STRING_STRUCT_STRING;    s->str = str;    s->refs = 0;    s->len = len;    add_ref(s);   
pike.git/src/stralloc.c:1871:    struct substring_pike_string *res;    void *strstart = s->str+(start<<shift);    size_t hval = low_do_hash(strstart,len,shift);    if( (existing =    internal_findstring(strstart, len, shift, hval)) )    {    add_ref(existing);    return existing;    }    res = ba_alloc(&substring_allocator); + #ifdef PIKE_DEBUG +  gc_init_marker(&res->str.m); + #endif    res->parent = s;    s->flags |= STRING_IS_LOCKED; /* Make sure the string data isn't reallocated. */    add_ref(s);    existing = &res->str;       existing->flags = STRING_NOT_SHARED;    existing->size_shift = shift;    existing->alloc_type = STRING_ALLOC_SUBSTRING;    existing->struct_type = STRING_STRUCT_SUBSTRING;    existing->hval = hval;