oio_write should have a more readable sig
This commit is contained in:
parent
5a5b435c5e
commit
20f38812e3
@ -740,13 +740,14 @@ static size_t oio__buf_count(oio_buf bufs[], int bufcnt) {
|
|||||||
/* The buffers to be written must remain valid until the callback is called.
|
/* The buffers to be written must remain valid until the callback is called.
|
||||||
* This is not required for the oio_buf array.
|
* This is not required for the oio_buf array.
|
||||||
*/
|
*/
|
||||||
int oio_write(oio_req* req, oio_buf* bufs, int bufcnt) {
|
int oio_write(oio_req* req, oio_buf bufs[], int bufcnt) {
|
||||||
oio_handle* handle = req->handle;
|
oio_handle* handle = req->handle;
|
||||||
assert(handle->fd >= 0);
|
assert(handle->fd >= 0);
|
||||||
|
|
||||||
ngx_queue_init(&req->queue);
|
ngx_queue_init(&req->queue);
|
||||||
req->type = OIO_WRITE;
|
req->type = OIO_WRITE;
|
||||||
|
|
||||||
|
/* TODO: Don't malloc for each write... */
|
||||||
req->bufs = malloc(sizeof(oio_buf) * bufcnt);
|
req->bufs = malloc(sizeof(oio_buf) * bufcnt);
|
||||||
memcpy(req->bufs, bufs, bufcnt * sizeof(oio_buf));
|
memcpy(req->bufs, bufs, bufcnt * sizeof(oio_buf));
|
||||||
req->bufcnt = bufcnt;
|
req->bufcnt = bufcnt;
|
||||||
|
|||||||
2
oio.h
2
oio.h
@ -209,7 +209,7 @@ int oio_accept(oio_handle* server, oio_handle* client,
|
|||||||
int oio_read_start(oio_handle* handle, oio_read_cb cb);
|
int oio_read_start(oio_handle* handle, oio_read_cb cb);
|
||||||
int oio_read_stop(oio_handle* handle);
|
int oio_read_stop(oio_handle* handle);
|
||||||
|
|
||||||
int oio_write(oio_req* req, oio_buf* bufs, int bufcnt);
|
int oio_write(oio_req* req, oio_buf bufs[], int bufcnt);
|
||||||
|
|
||||||
/* Timer methods */
|
/* Timer methods */
|
||||||
int oio_timeout(oio_req* req, int64_t timeout);
|
int oio_timeout(oio_req* req, int64_t timeout);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user