pike.git / src / stralloc.c

version» Context lines:

pike.git/src/stralloc.c:812:   {    struct pike_string *s;    ptrdiff_t h = StrHash(str, len);       s = internal_findstring(str,len,shift,h);       if (!s) {    s = make_static_string(str, len, shift);    link_pike_string(s, h);    } else { +  +  if (!string_is_static(s)) { +  if (string_is_block_allocated(s)) { +  ba_free(&string_allocator, s->str); +  } else { +  free(s->str); +  } +  s->flags &= ~STRING_ALLOC_MASK; +  s->flags |= STRING_ALLOC_STATIC; +  s->str = str; +  } +     add_ref(s);    }       return s;   }      /*    * This function assumes that the shift size is already the minimum it    * can be.    */