pike.git / src / stralloc.c

version» Context lines:

pike.git/src/stralloc.c:534:    break;    case STRING_ALLOC_SUBSTRING:    free_string(((struct substring_pike_string*)s)->parent);    break;    }   }      static void free_unlinked_pike_string(struct pike_string * s)   {    free_string_content(s); +  dmalloc_unregister(s, 0);    switch(s->struct_type)    {    case STRING_STRUCT_STRING:    ba_free(&string_allocator, s);    break;    case STRING_STRUCT_SUBSTRING:    ba_free(&substring_allocator, s);    break;    }   }
pike.git/src/stralloc.c:662: Inside #if defined(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);   #endif +  dmalloc_register(t, sizeof(struct pike_string), DMALLOC_LOCATION());    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:694:   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 +  dmalloc_register(t, sizeof(struct pike_string), DMALLOC_LOCATION());    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:752:    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);   #endif +  dmalloc_register(s, sizeof(struct pike_string), DMALLOC_LOCATION());       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:1896:    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);   #endif +  dmalloc_register(res, sizeof(struct substring_pike_string), DMALLOC_LOCATION());    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;