Skip to content

Commit c5c944d

Browse files
authored
Merge pull request #6 from ace411/develop
v0.1.0 changes
2 parents 621d485 + 33e82c7 commit c5c944d

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ Funnels file descriptor in readable stream into event loop and thence executes a
156156
- **nbytes** (int|null) - The number of bytes to read.
157157
> Specifying `null` will condition the use of a 1KB buffer.
158158
- **vcount** (int|null) - The number of read vectors to use.
159-
> Specifying `null` will condition the use of 2 vectors.
159+
> Specifying `null` will condition the use of `1` vector.
160160
> Any value north of `8` will likely result in an inefficient read.
161161
- **offset** (int|null) - The point at which to start the read operation.
162162
> Specifying `null` will condition the use of an offset of `0`.
@@ -214,7 +214,7 @@ Funnels file descriptor in writable stream into event loop and thence executes a
214214
> The file descriptor in the stream is internally given a non-blocking disposition.
215215
- **contents** (string) - The contents to write to the file descriptor.
216216
- **vcount** (int|null) - The number of write vectors to use.
217-
> Specifying `null` will condition the use of 2 vectors.
217+
> Specifying `null` will condition the use of `1` vector.
218218
> Any value north of `8` will likely result in an inefficient write.
219219
- **callback** (callable) - The unary function through which the number of written bytes is propagated.
220220

src/loop.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ static void *php_mrloop_tcp_client_setup(int fd, char **buffer, int *bsize)
261261

262262
conn = emalloc(sizeof(php_mrloop_conn_t));
263263
conn->fd = fd;
264-
conn->buffer = emalloc(MRLOOP_G(tcp_buff_size));
264+
conn->buffer = ecalloc(1, MRLOOP_G(tcp_buff_size));
265265
*buffer = conn->buffer;
266266
*bsize = MRLOOP_G(tcp_buff_size);
267267

@@ -587,7 +587,7 @@ static void php_mrloop_add_read_stream(INTERNAL_FUNCTION_PARAMETERS)
587587
foffset = (size_t)(offset_null == true ? DEFAULT_READV_OFFSET : offset);
588588

589589
iov = emalloc(sizeof(php_iovec_t));
590-
iov->iov_base = emalloc(fnbytes);
590+
iov->iov_base = ecalloc(1, fnbytes);
591591
iov->iov_len = fnbytes;
592592

593593
cb = emalloc(sizeof(php_mrloop_cb_t));
@@ -634,7 +634,7 @@ static void php_mrloop_add_write_stream(INTERNAL_FUNCTION_PARAMETERS)
634634

635635
nbytes = ZSTR_LEN(contents);
636636
iov = emalloc(sizeof(php_iovec_t));
637-
iov->iov_base = emalloc(nbytes);
637+
iov->iov_base = ecalloc(1, nbytes);
638638
iov->iov_len = nbytes;
639639

640640
strcpy(iov->iov_base, ZSTR_VAL(contents));

src/loop.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#define DEFAULT_STREAM_BUFF_LEN 1024
2727
#define DEFAULT_CONN_BUFF_LEN 8132
2828
#define DEFAULT_HTTP_HEADER_LIMIT 100
29-
#define DEFAULT_VECTOR_COUNT 2
29+
#define DEFAULT_VECTOR_COUNT 1
3030
#define DEFAULT_READV_OFFSET 0
3131
#define PHP_MRLOOP_TIMER 1
3232
#define PHP_MRLOOP_PERIODIC_TIMER 2

0 commit comments

Comments
 (0)