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

version» Context lines:

pike.git/src/modules/_Stdio/buffer.cmod:227:       /*    * It is actually not certain that checking this is a good idea.    *    * The reason being that if the current buffer size is very small    * (io_len(io)) and the bytes added is large and there is an    * offset, it makes sense to move now when we do not have to copy    * as much.    *    */ -  if( UNLIKELY(force && io->offset -  || io_len(io) && io->offset > io->allocated / 2) ) +  if( UNLIKELY((force && io->offset) +  || (io_len(io) && io->offset > io->allocated / 2)) )    {    /* more than 50% of the buffer is available before the read pointer,    * and we can discard that data. Move the data to the beginning, making    * room for more data.    */    io_discard_bufstart(io);    }       if( UNLIKELY(io->len + bytes > io->allocated) )    {
pike.git/src/modules/_Stdio/buffer.cmod:1831:    *! @[_search()]    */    PIKEFUN string(8bit) read_cstring(void|int sentinel)    {    Buffer *io = THIS;    int csentinel = sentinel ? sentinel->u.integer : 0;       do    if ( LIKELY(io_len(THIS)) )    { -  const char * start = io_read_pointer(io); +  const char * start = (char*)io_read_pointer(io);    const char * end = memchr(start, csentinel, io_len(io));    if ( LIKELY(end) )    {    push_string(io_read_string(io, end - start));    io_read_byte_uc(io); /* consume the terminating sentinel byte */    return;    }    }    while ( UNLIKELY(io_range_error(THIS, 0)) );