pike.git / src / builtin.cmod

version» Context lines:

pike.git/src/builtin.cmod:3102:    */    PIKEFUN object `+( string|Buffer what )    rawtype tFunc(tOr(tString, tObjIs_BUFFER), tObjIs_BUFFER);    {    struct Buffer_struct *str = THIS, *str2;    struct object *res = fast_clone_object( Buffer_program );    str2 = OBJ2_BUFFER( res );    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;    }       /*! @decl String.Buffer `+=( string|String.Buffer what )    */    PIKEFUN object `+=( string|Buffer what )    rawtype tFunc(tOr(tString, tObjIs_BUFFER), tObjIs_BUFFER);    {    f_Buffer_add( 1 );
pike.git/src/builtin.cmod:3344:    struct pike_string *str = THIS->str.s;    if( str )    {    ptrdiff_t len = str->len;    if( len > 0 )    {    char *d = (char *)str->str;    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();    return;    }       /*! @decl string get()    *!    *! Get the data from the buffer.    *!
pike.git/src/builtin.cmod:3377:    *! @[get_copy()], @[clear()]    */    PIKEFUN string get( )    {    struct Buffer_struct *str = THIS;    if( str->str.s )    {    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);    push_empty_string();    return;    }       /*! @decl void clear()    *!    *! Empty the buffer, and don't care about the old content.
pike.git/src/builtin.cmod:3428:    {    struct Buffer_struct *str = THIS;    MEMSET( str, 0, sizeof( *str ) );    }       EXIT    gc_trivial;    {    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    {    if (mc_count_bytes (Pike_fp->current_object) && THIS->str.s)    mc_counted_bytes += THIS->str.malloced;    }   }      /*! @endclass    */