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

version» Context lines:

pike.git/src/modules/_Stdio/buffer.cmod:247:    memmove( io->buffer, io_read_pointer(io), io_len(io) );    io->num_move++;    io->len -= io->offset;    io->offset = 0;    }    }       if( UNLIKELY(io->len + bytes > io->allocated) )    {    /* Actually grow the buffer. */ +  void *new_ptr;    size_t growth =    (io->allocated>>1) +    (io->allocated>>3);/* io->allocated * 0.625 */       if( growth < bytes )    growth = bytes + (bytes>>1);       if( io->allocated + growth < io->allocated )    {    growth = bytes+1;    if( io->allocated + growth < io->allocated )    Pike_error("Overflow in buffer size calculations\n");    } -  void *new_ptr = xrealloc( io->buffer, io->allocated + growth ); +  new_ptr = xrealloc( io->buffer, io->allocated + growth );    if( !new_ptr )    Pike_error(msg_out_of_mem_2, io->allocated+growth );    io->buffer = new_ptr;    io->num_malloc++;    io->allocated += growth;    }    return io->buffer+io->len;    }       static unsigned char *io_add_space( Buffer *io, size_t bytes, int force )