Branch: Tag:

2005-01-18

2005-01-18 17:53:58 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Backported modify_shared_string() fix from Pike 7.7.

Rev: src/stralloc.c:1.168

2:   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: stralloc.c,v 1.167 2005/01/14 14:27:27 grubba Exp $ + || $Id: stralloc.c,v 1.168 2005/01/18 17:53:58 grubba Exp $   */      #include "global.h"
24:   #include <ctype.h>   #include <math.h>    - RCSID("$Id: stralloc.c,v 1.167 2005/01/14 14:27:27 grubba Exp $"); + RCSID("$Id: stralloc.c,v 1.168 2005/01/18 17:53:58 grubba Exp $");      /* #define STRALLOC_USE_PRIMES */   
1587:    {    /* Doesn't change hash value - sneak it in there */    low_set_index(a,index,c); +  unlink_pike_string(a); +  old = internal_findstring(a->str, a->len, a->size_shift, a->hval); +  if (old) { +  /* The new string is equal to some old string. */ +  really_free_pike_string(a); +  add_ref(a = old); +  } else { +  link_pike_string(a, a->hval); +  }    return a;    }else{    unlink_pike_string(a);