Branch: Tag:

2008-06-23

2008-06-23 16:05:02 by Martin Stjernholm <mast@lysator.liu.se>

Adaptions to new SearchMojt behavior. Fixed some possible leaks on (at
least) out-of-memory errors.

Rev: src/array.c:1.210
Rev: src/stralloc.c:1.221

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.220 2008/06/16 21:46:34 mast Exp $ + || $Id: stralloc.c,v 1.221 2008/06/23 16:05:02 mast Exp $   */      #include "global.h"
1852:    ADD_PCHARP(MKPCHARP_STR(haystack), start),    haystack->len - start).ptr;    -  mojt.vtab->freeme(mojt.data); +  if (mojt.container) free_object (mojt.container);       if(!r) return -1;   #ifdef PIKE_DEBUG
1911:    PCHARP r;    int shift;    SearchMojt mojt; +  ONERROR mojt_uwp;    replace_searchfunc f = (replace_searchfunc)0;       if(!str->len)
1944:    del->len,    str->len,    del); +  SET_ONERROR (mojt_uwp, do_free_object, mojt.container); +     ret=begin_wide_shared_string(str->len,shift);    switch(str->size_shift)    {
1961:    del->len,    str->len*2,    del); +  SET_ONERROR (mojt_uwp, do_free_object, mojt.container);       switch(str->size_shift)    {
1980:       if(!delimeters)    { -  mojt.vtab->freeme(mojt.data); +  CALL_AND_UNSET_ONERROR (mojt_uwp);    add_ref(str);    return str;    }
2004:    }    generic_memcpy(r,MKPCHARP(s,str->size_shift),(end-s)>>str->size_shift);    -  mojt.vtab->freeme(mojt.data); +  CALL_AND_UNSET_ONERROR (mojt_uwp);    return end_shared_string(ret);   }