Branch: Tag:

2014-12-04

2014-12-04 19:26:55 by Per Hedbor <ph@opera.com>

Added a few OBJECT_CLEAR_ON_EXIT clears.

Images, String.Buffer objects and Gmp.mpz objects now honor the flag
for not only the object structure, but also the data in the object.

3109:    str2->initial = str->initial;    if( str->str.s )    init_string_builder_copy (&str2->str, &str->str); +  if( (Pike_fp->current_object->flags & OBJECT_CLEAR_ON_EXIT) ) +  res->flags |= OBJECT_CLEAR_ON_EXIT;    apply( res, "add", 1 );    RETURN res;    }
3351:    switch( str->size_shift )    {    case 0: -  RETURN make_shared_binary_string0((p_wchar0 *)d,len); +  str=make_shared_binary_string0((p_wchar0 *)d,len);    break;    case 1: -  RETURN make_shared_binary_string1((p_wchar1 *)d,len); +  str=make_shared_binary_string1((p_wchar1 *)d,len);    break;    case 2: -  RETURN make_shared_binary_string2((p_wchar2 *)d,len); +  str=make_shared_binary_string2((p_wchar2 *)d,len);    break;    } -  +  if( Pike_fp->current_object->flags & OBJECT_CLEAR_ON_EXIT ) +  str->flags |= STRING_CLEAR_ON_EXIT; +  RETURN str;    }    }    push_empty_string();
3384:    struct pike_string *s = finish_string_builder( &str->str );    str->str.malloced = 0;    str->str.s = NULL; +  if( Pike_fp->current_object->flags & OBJECT_CLEAR_ON_EXIT ) +  s->flags |= STRING_CLEAR_ON_EXIT;    RETURN s;    }    pop_n_elems(args);
3435:    {    struct Buffer_struct *str = THIS;    if( str->str.s ) +  { +  if( Pike_fp->flags & OBJECT_CLEAR_ON_EXIT ) +  memset( str->str.s->str, 0, str->str.s->len );    free_string_builder( &str->str );    } -  +  }       GC_RECURSE    {