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

version» Context lines:

pike.git/src/modules/_Stdio/buffer.cmod:17:   #include "cyclic.h"   #include "backend.h"   #include "fd_control.h"   #include "file_machine.h"   #include "file.h"   #include "whitespace.h"   #include "pike_types.h"   #include "pike_threadlib.h"   #include "buffer.h"   #include "module_support.h" + #include "bitvector.h"      #ifdef HAVE_ARPA_INET_H   #include <arpa/inet.h>   #endif      #undef MP_INT   #include <gmp.h>      #define DEFAULT_CMOD_STORAGE static   DECLARATIONS
pike.git/src/modules/_Stdio/buffer.cmod:275:    {    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) )    { -  size_t new_len = io->allocated; +  size_t new_len;    void *new_ptr;    -  do -  new_len = ((new_len+32)*2)-32; -  while( new_len < io->len + bytes ); + #if SIZEOF_CHARP == 8 +  new_len = round_up64(io->len+bytes); + #else +  new_len = round_up32(io->len+bytes); + #endif +  if( !new_len ) +  Pike_error(msg_out_of_mem_2, io->len+bytes);       new_ptr = xrealloc( io->buffer, new_len );    if( !new_ptr )    Pike_error(msg_out_of_mem_2, new_len );    io->buffer = new_ptr;    io->num_malloc++;    io->allocated = new_len;    }    return io->buffer+io->len;    }