Skip to content

Commit

Permalink
lib: istream - migrate more to i_stream_read_more()
Browse files Browse the repository at this point in the history
More coccinelle semantic patching, again hand-checked.

  git grep 'i_stream_read_data' | sed s/:.*// | \
    while read f; do spatch --sp-file istream0.cocci --in-place "$f" ; done

-- 8< --- istream0.cocci ---
@@
expression e1, e2, e3;
@@

- i_stream_read_data(e1, e2, e3, 0)
+ i_stream_read_more(e1, e2, e3)
-- 8< --- end

Signed-off-by: Phil Carmody <phil@dovecot.fi>
  • Loading branch information
Phil Carmody authored and GitLab committed May 16, 2016
1 parent 5734244 commit 9184983
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 10 deletions.
3 changes: 1 addition & 2 deletions src/doveadm/dsync/dsync-ibc-stream.c
Expand Up @@ -235,8 +235,7 @@ static int dsync_ibc_stream_send_value_stream(struct dsync_ibc_stream *ibc)
size_t i, size;
int ret;

while ((ret = i_stream_read_data(ibc->value_output,
&data, &size, 0)) > 0) {
while ((ret = i_stream_read_more(ibc->value_output, &data, &size)) > 0) {
add = '\0';
for (i = 0; i < size; i++) {
if (data[i] == '.' &&
Expand Down
3 changes: 1 addition & 2 deletions src/lib-compression/istream-lz4.c
Expand Up @@ -130,8 +130,7 @@ static ssize_t i_stream_lz4_read(struct istream_private *stream)

/* read the whole compressed chunk into memory */
while (zstream->chunk_left > 0 &&
(ret = i_stream_read_data(zstream->istream.parent,
&data, &size, 0)) > 0) {
(ret = i_stream_read_more(zstream->istream.parent, &data, &size)) > 0) {
if (size > zstream->chunk_left)
size = zstream->chunk_left;
buffer_append(zstream->chunk_buf, data, size);
Expand Down
3 changes: 1 addition & 2 deletions src/lib-http/http-header-parser.c
Expand Up @@ -296,8 +296,7 @@ int http_header_parse_next_field(struct http_header_parser *parser,

*error_r = NULL;

while ((ret=i_stream_read_data
(parser->input, &parser->begin, &size, 0)) > 0) {
while ((ret=i_stream_read_more(parser->input, &parser->begin, &size)) > 0) {

/* check header size limits */
if (parser->size >= max_size) {
Expand Down
3 changes: 1 addition & 2 deletions src/lib-http/http-transfer-chunked.c
Expand Up @@ -311,8 +311,7 @@ static int http_transfer_chunked_parse_next(
size_t size;
int ret;

while ((ret=i_stream_read_data
(input, &tcstream->begin, &size, 0)) > 0) {
while ((ret=i_stream_read_more(input, &tcstream->begin, &size)) > 0) {
tcstream->cur = tcstream->begin;
tcstream->end = tcstream->cur + size;

Expand Down
3 changes: 1 addition & 2 deletions src/lib-lda/lmtp-client.c
Expand Up @@ -326,8 +326,7 @@ static int lmtp_client_send_data(struct lmtp_client *client)
if (client->output_finished)
return 0;

while ((ret = i_stream_read_data(client->data_input,
&data, &size, 0)) > 0) {
while ((ret = i_stream_read_more(client->data_input, &data, &size)) > 0) {
add = '\0';
for (i = 0; i < size; i++) {
if (data[i] == '\n') {
Expand Down

0 comments on commit 9184983

Please sign in to comment.