pike.git / src / stralloc.c

version» Context lines:

pike.git/src/stralloc.c:526:   struct pike_string_hdr {    PIKE_STRING_CONTENTS;   };      /* Allocate some fixed string sizes with BLOCK_ALLOC. */      /* Use the BLOCK_ALLOC() stuff for short strings */      #undef INIT_BLOCK   #define INIT_BLOCK(NEW_STR) do { \ -  (NEW_STR)->refs = 1; \ +  (NEW_STR)->refs = 0; \ +  add_ref((NEW_STR)); \    (NEW_STR)->flags = \    STRING_NOT_HASHED|STRING_NOT_SHARED|STRING_IS_SHORT; \    } while(0)      #define SHORT_STRING_BLOCK 256   #define SHORT_STRING_THRESHOLD 15 /* % 4 === -1 */      struct short_pike_string0 {    PIKE_STRING_CONTENTS;    p_wchar0 str[SHORT_STRING_THRESHOLD+1];
pike.git/src/stralloc.c:716:    Pike_fatal("Unsupported string shift: %d\n", shift);   #endif /* PIKE_DEBUG */    } else {    t = (struct pike_string *)alloc_short_pike_string2();    }    } else {    t=(struct pike_string *)xalloc(((len + 1)<<shift) +    sizeof(struct pike_string_hdr));    t->flags = STRING_NOT_HASHED|STRING_NOT_SHARED;    } -  t->refs = 1; +  t->refs = 0; +  add_ref(t); /* For DMALLOC */    t->len=len;    t->size_shift=shift;    DO_IF_DEBUG(t->next = NULL);    low_set_index(t,len,0);    return t;   }      PMOD_EXPORT void hash_string(struct pike_string *s)   {    if (!(s->flags & STRING_NOT_HASHED)) return;