pike.git / src / modules / _Stdio / buffer.cmod

version» Context lines:

pike.git/src/modules/_Stdio/buffer.cmod:61:   {   #if PRECOMPILE_API_VERSION > 5    PIKEVAR int b.num_malloc;    PIKEVAR int b.num_move;   #endif       CVAR IOBuffer b;       static void io_set_error_mode( IOBuffer *io, struct program *m )    { -  if( m ) m->refs++; +  if( m ) add_ref(m);    if( io->error_mode ) free_program( io->error_mode );    io->error_mode = m;    }       static size_t io_len( IOBuffer *io )    {    return io->len-io->offset;    }       static void io_unlock( IOBuffer *io )
pike.git/src/modules/_Stdio/buffer.cmod:553:    return NULL;       b = low_clone( IOBuffer_program );    to = get_storage(b,IOBuffer_program);       io_lock( io );       to->buffer = io_read_pointer(io);    to->len = len;    to->sub = Pike_fp->current_object; -  to->sub->refs++; +  add_ref(to->sub);    io_consume( io, len );       if( do_copy )    io_ensure_malloced( to, 0 );       return b;    }       static int io_read_byte_uc( IOBuffer *io )    {
pike.git/src/modules/_Stdio/buffer.cmod:742:    if( !s->len ) return;    if( s->size_shift ) Pike_error("IOBuffer only handles 8bit data\n");    if( !io->buffer )    {   #ifdef PIKE_DEBUG    if (io->str) Pike_fatal("IOBuffer with string but NULL buffer.\n");   #endif    io->str = s;    io->buffer = (unsigned char*)s->str;    io->len = s->len; -  s->refs++; +  add_ref(s);    }    else    io_append( io, s->str, s->len );    }    break;    case PIKE_T_ARRAY:    {    struct array *argp = p->u.array;    INT_TYPE i;    DECLARE_CYCLIC();
pike.git/src/modules/_Stdio/buffer.cmod:776:    void *ptr;    struct sysmem *s;    enum memobj_type t = get_memory_object_memory( p->u.object, &ptr, &len, NULL );       if( !io->buffer && t==MEMOBJ_SYSTEM_MEMORY )    {    io->buffer = ptr;    io->len = len;       io->source = p->u.object; -  io->source->refs++; +  add_ref(io->source);    return;    }    if( t != MEMOBJ_NONE )    io_append( io, ptr, len );    else    Pike_error("Unsupported argument type\n");    }    break;    case PIKE_T_INT:    {
pike.git/src/modules/_Stdio/buffer.cmod:887:    PIKEFUN void __fd_set_output( int(0..0)|object f )    {    IOBuffer *io = THIS;    if( io->output ) free_object(io->output);    io->output_triggered = 0;    if( TYPEOF(*f) != PIKE_T_OBJECT )    io->output = 0;    else    {    io->output = f->u.object; -  io->output->refs++; +  add_ref(io->output);    }    }       /*! @decl int(-1..) output_to( Stdio.Stream f, int(0..)|void nbytes )    *!    *! Write data from the buffer to the indicated file.    *!    *! @param nbytes    *! If @[nbytes] is not specified the whole buffer will be written    *! if possible. Otherwise at most @[nbytes] will be written.
pike.git/src/modules/_Stdio/buffer.cmod:2007:    {    IOBuffer *this = THIS;    if( this->buffer )    Pike_error("Can not initialize twice.\n");    if( x->size_shift )    Pike_error("Can not handle non-8bit data.\n");    this->buffer = (unsigned char*)x->str;    this->len = x->len;    this->malloced = 0;    this->str = x; -  x->refs++; +  add_ref(x);    }       /*! @decl void read_only()    *!    *! Make the buffer permanently read only.    *! @note    *! You can use lock() to do this temporarily.    */    PIKEFUN void read_only()    {