[dovecot/core] 09142e: lib: istream - provide alternatives to i_stream_re...

GitHub noreply at github.com
Mon May 16 18:30:14 UTC 2016


  Branch: refs/heads/master
  Home:   https://github.com/dovecot/core
  Commit: 09142ea11662746ea07475b1a4f69a6a406fb996
      https://github.com/dovecot/core/commit/09142ea11662746ea07475b1a4f69a6a406fb996
  Author: Phil Carmody <phil at dovecot.fi>
  Date:   2016-05-16 (Mon, 16 May 2016)

  Changed paths:
    M src/lib/istream.h

  Log Message:
  -----------
  lib: istream - provide alternatives to i_stream_read_data()

Providing as a parameter the number of bytes that you would be
disappointed to receive was confusing compared to providing the
number that you would be happy to receive. This lets us get rid
of all the '-1's in the callers. The callers which used 0 as
a parameter were so common that it's worth providing a separate
API just to simplify their demands.

Deep down, these are still the same underlying function. Currently
we route the new API through the old one, but eventually, the old
API can be routed through the new one, so that the friendlier
interface has the simplest implementation.

Signed-off-by: Phil Carmody <phil at dovecot.fi>


  Commit: 3858a7a5da361c35f1e6e50c8e3214dc0cf379d6
      https://github.com/dovecot/core/commit/3858a7a5da361c35f1e6e50c8e3214dc0cf379d6
  Author: Phil Carmody <phil at dovecot.fi>
  Date:   2016-05-16 (Mon, 16 May 2016)

  Changed paths:
    M src/director/director-test.c
    M src/doveadm/doveadm-fs.c
    M src/doveadm/doveadm-print.c
    M src/doveadm/doveadm-zlib.c
    M src/doveadm/dsync/dsync-mail.c
    M src/doveadm/dsync/dsync-mailbox-import.c
    M src/imap-urlauth/imap-urlauth-worker.c
    M src/imap/cmd-setmetadata.c
    M src/lda/main.c
    M src/lib-compression/istream-bzlib.c
    M src/lib-compression/istream-lzma.c
    M src/lib-compression/istream-zlib.c
    M src/lib-compression/test-compression.c
    M src/lib-dict-extra/dict-fs.c
    M src/lib-fs/fs-api.c
    M src/lib-http/http-message-parser.c
    M src/lib-http/test-http-client.c
    M src/lib-http/test-http-transfer.c
    M src/lib-mail/istream-attachment-extractor.c
    M src/lib-mail/istream-qp-decoder.c
    M src/lib-mail/message-size.c
    M src/lib-mail/test-istream-attachment.c
    M src/lib-mail/test-istream-binary-converter.c
    M src/lib-mail/test-istream-qp-decoder.c
    M src/lib-ssl-iostream/iostream-openssl.c
    M src/lib-storage/index/imapc/imapc-mail.c
    M src/lib-storage/index/index-mail-binary.c
    M src/lib-storage/index/mbox/istream-raw-mbox.c
    M src/lib-storage/mailbox-attribute.c
    M src/lib/ostream.c
    M src/lib/test-istream-unix.c
    M src/login-common/client-common-auth.c
    M src/plugins/fts-solr/solr-connection.c
    M src/plugins/fts/fts-parser-tika.c
    M src/plugins/mail-filter/ostream-ext-filter.c
    M src/plugins/pop3-migration/pop3-migration-plugin.c
    M src/pop3/pop3-commands.c

  Log Message:
  -----------
  lib: istream - migrate to i_stream_read_more()

Scripted to find all the low-hanging-fruit (single line calls), but hand-checked:

  git grep i_stream_read_data.*,\ 0\) | sed s/:.*// | \
    xargs sed -i -e 's/i_stream_read_data(\(.*\), \(.*\), \(.*\), 0)/i_stream_read_more(\1, \2, \3)/'

Signed-off-by: Phil Carmody <phil at dovecot.fi>


  Commit: 534e41e436a7546f36f61e0dc49c0c191d850f6b
      https://github.com/dovecot/core/commit/534e41e436a7546f36f61e0dc49c0c191d850f6b
  Author: Phil Carmody <phil at dovecot.fi>
  Date:   2016-05-16 (Mon, 16 May 2016)

  Changed paths:
    M src/doveadm/doveadm-dump-dbox.c
    M src/lib-compression/compression.c
    M src/lib-fs/ostream-cmp.c
    M src/lib-index/mail-index-strmap.c
    M src/lib-storage/index/dbox-common/dbox-file-fix.c
    M src/lib-storage/list/subscription-file.c
    M src/lib/istream.h

  Log Message:
  -----------
  lib: istream - migrate to i_stream_read_bytes()

Scripted to pick off the low hanging fruit, one liners with an explicit
'-1' in the final parameter, but hand-checked.

  git grep 'i_stream_read_data.*, [^,]*- \?1)' | sed s/:.*// | \
    xargs sed -i -e 's/i_stream_read_data(\(.*\), \(.*\), \(.*\), \(.*[^ ]\) \?- \?1)/i_stream_read_bytes(\1, \2, \3, \4)/'

Signed-off-by: Phil Carmody <phil at dovecot.fi>


  Commit: 573424407a2d3c1453638a643583a7cf10c129e1
      https://github.com/dovecot/core/commit/573424407a2d3c1453638a643583a7cf10c129e1
  Author: Phil Carmody <phil at dovecot.fi>
  Date:   2016-05-16 (Mon, 16 May 2016)

  Changed paths:
    M src/lib-compression/compression.c
    M src/lib-compression/istream-lz4.c
    M src/lib-compression/istream-zlib.c
    M src/lib-fs/fs-api.c
    M src/lib-index/mail-index-strmap.c
    M src/lib-lda/duplicate.c
    M src/lib-storage/index/dbox-common/dbox-file.c
    M src/lib/istream.h
    M src/lib/ostream-file.c
    M src/plugins/fts/fts-expunge-log.c

  Log Message:
  -----------
  lib: istream - more migration to i_stream_read_bytes()

This time a coccinelle semantic patch, again hand checked:

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

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

- i_stream_read_data(e1, e2, e3, e4 - 1)
+ i_stream_read_bytes(e1, e2, e3, e4)

-- 8< --- end

Signed-off-by: Phil Carmody <phil at dovecot.fi>


  Commit: 9184983183ae28fb543695c54c85bc5396c07e42
      https://github.com/dovecot/core/commit/9184983183ae28fb543695c54c85bc5396c07e42
  Author: Phil Carmody <phil at dovecot.fi>
  Date:   2016-05-16 (Mon, 16 May 2016)

  Changed paths:
    M src/doveadm/dsync/dsync-ibc-stream.c
    M src/lib-compression/istream-lz4.c
    M src/lib-http/http-header-parser.c
    M src/lib-http/http-transfer-chunked.c
    M src/lib-lda/lmtp-client.c

  Log Message:
  -----------
  lib: istream - migrate more to i_stream_read_more()

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 at dovecot.fi>


Compare: https://github.com/dovecot/core/compare/9aa483ebcba6...9184983183ae


More information about the dovecot-cvs mailing list