pike.git / src / modules / _Stdio / file.c

version» Context lines:

pike.git/src/modules/_Stdio/file.c:1063:    return end_and_resize_shared_string(str, bytes_read);    }       }else{    /* For some reason, 8k seems to work faster than 64k.    * (4k seems to be about 2% faster than 8k when using linux though)    * /Hubbe (Per pointed it out to me..)    */   #define CHUNK ( 1024 * 8 )    INT32 try_read; -  dynamic_buffer b; +  struct byte_buffer b;    -  initialize_buf(&b); +  buffer_init(&b);    SET_ONERROR(ebuf, buffer_free, &b);    do{    int e;    try_read=MINIMUM(CHUNK,r);      #ifdef HAVE_STRUCT_MSGHDR_MSG_CONTROL    message.msg.msg_control = &message.cmsgbuf;    message.msg.msg_controllen = sizeof(message.cmsgbuf);   #else    message.msg.msg_accrights = (void *)&message.cmsgbuf;    message.msg.msg_accrightslen = sizeof(message.cmsgbuf);   #endif -  message.iov.iov_base = low_make_buf_space(try_read, &b); +  message.iov.iov_base = buffer_alloc(&b, try_read);    message.iov.iov_len = try_read;       THREADS_ALLOW();    i = recvmsg(fd, &message.msg, 0);    e=errno;    THREADS_DISALLOW();       check_threads_etc();       if(i>0)
pike.git/src/modules/_Stdio/file.c:1102: Inside #if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
   if (   #ifdef HAVE_STRUCT_MSGHDR_MSG_CONTROL    message.msg.msg_controllen   #else    message.msg.msg_accrightslen   #endif    ) {    check_message(&message.msg);    }    if (i != try_read) { -  low_make_buf_space(i - try_read, &b); +  buffer_remove(&b, try_read - i);    }    if(!all) break;    }    else if(i==0)    { -  low_make_buf_space(-try_read, &b); +  buffer_remove(&b, try_read);    break;    }    else    { -  low_make_buf_space(-try_read, &b); +  buffer_remove(&b, try_read);    if(e != EINTR)    {    ERRNO=e;    if(!bytes_read)    {    buffer_free(&b);    UNSET_ONERROR(ebuf);    return 0;    }    break;    }    }    }while(r);       UNSET_ONERROR(ebuf);       if(!SAFE_IS_ZERO(& THIS->event_cbs[PIKE_FD_READ]))    ADD_FD_EVENTS (THIS, PIKE_BIT_FD_READ);    -  return low_free_buf(&b); +  return buffer_finish_pike_string(&b);   #undef CHUNK    }   }      /* Send a set of iovecs and fds over an fd. */   static int writev_fds(int fd, struct iovec *iov, int iovcnt,    int *fds, int num_fds)   {    int retval, e;    struct msghdr msg;