[dovecot/core] 2d7293: lib: array - new copy-making array iterator

GitHub noreply at github.com
Tue Apr 19 18:00:10 UTC 2016


  Branch: refs/heads/master
  Home:   https://github.com/dovecot/core
  Commit: 2d729323913a672708dc600242e1cc3085985dcc
      https://github.com/dovecot/core/commit/2d729323913a672708dc600242e1cc3085985dcc
  Author: Phil Carmody <phil at dovecot.fi>
  Date:   2016-04-19 (Tue, 19 Apr 2016)

  Changed paths:
    M src/lib/array.h

  Log Message:
  -----------
  lib: array - new copy-making array iterator

Previously macros took a pointer, and that pointer was made to pointed
to each element of the array in turn. Typical use cases for things like
char* or struct* arrays were to immediately/repeatedly, dereference that
pointer.

This new iter (only one implementation done so far, more a proof of
concept) gets rid of the user-visable pointer, and performs the
dereference every time, and only when, a valid element is being
iterated over. Empty array => no assignment. No U.B.

NOTE: This cannot be done without assuming C99. It breaks the build
on compilers that old if any components that are enabled use the
macro. It strongly suggests we just need to make C99 mandatory.

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


  Commit: 0700888606b96665902af9bf0157dc152850ae27
      https://github.com/dovecot/core/commit/0700888606b96665902af9bf0157dc152850ae27
  Author: Phil Carmody <phil at dovecot.fi>
  Date:   2016-04-19 (Tue, 19 Apr 2016)

  Changed paths:
    M src/lib/test-array.c

  Log Message:
  -----------
  lib: test-array - test new element-assigning iterator

Test that both (small) object copying and const/nonconst pointer copies work.

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


  Commit: bb0eabc25c8ec2ee98e31fb81274481cc8ed245e
      https://github.com/dovecot/core/commit/bb0eabc25c8ec2ee98e31fb81274481cc8ed245e
  Author: Phil Carmody <phil at dovecot.fi>
  Date:   2016-04-19 (Tue, 19 Apr 2016)

  Changed paths:
    M src/lib/bits.h

  Log Message:
  -----------
  lib: bits - new fractional log-like helper

For stats gathering, where the data can have a wide range of values, you
don't necessarily need the same granularity along the full range of values.
For example, 1ms and 11ms latencies are very different, but 1.001s and
1.011s latencies are not worth distinguishing. Something logarithmic seems
more apt. Simply looking at power-of-2 sized bands (e.g. doing log2(n)),
however, is too granular, so these new helpers let you specify how fine
to (linearly) subdivide each of those bands. 1 fractional bit splits
each power of 2 band into 2 halves. 2 fractional bits splits each power
of 2 band into 4 quarters, and so on. 0 fractional bits is just log2().

Exact identification of percentiles is impossible, but it was anyway, as you
simply cannot store all the data required to calculate them. However, a mere
896 buckets will permit you to have 32 bands per power of 2, 5 fracional bits.
The above example would have buckets such as 2.432s-2.496s, and 55.3s-56.3s.
Assuming smooth distribution lets you calculate percentiles more accurately,
just assume within each bucket is a trapezial distribution. This holds even
if the distribution is multi-modal, which it will be. However, maths required.

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


  Commit: 20be2a7b3ad5aa062d15e0d7146aaad3ba172804
      https://github.com/dovecot/core/commit/20be2a7b3ad5aa062d15e0d7146aaad3ba172804
  Author: Phil Carmody <phil at dovecot.fi>
  Date:   2016-04-19 (Tue, 19 Apr 2016)

  Changed paths:
    M src/lib/test-bits.c

  Log Message:
  -----------
  lib: test-bits - test the new fractional log helpers

Ensure that the beginning and end of every bucket range are both mapped
into that bucket. It also checks that the bucket ranges are contiguous.
Assuming the function's weakly monatonic, this is as good as testing
every single value.

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


  Commit: 943ba393dafc67e0df779829c3d33ac34bcb3fa3
      https://github.com/dovecot/core/commit/943ba393dafc67e0df779829c3d33ac34bcb3fa3
  Author: Phil Carmody <phil at dovecot.fi>
  Date:   2016-04-19 (Tue, 19 Apr 2016)

  Changed paths:
    M src/lib/test-bits.c

  Log Message:
  -----------
  lib: test-bits - add fraclog test for most usual case, constant fracbits

Were there to be any difference between the constant and non-constant tests,
then it would be a compiler error, but it's better to be defensive and know
about that case.

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


  Commit: 84f697c5e30565823619abaaeb57164c789d4b66
      https://github.com/dovecot/core/commit/84f697c5e30565823619abaaeb57164c789d4b66
  Author: Phil Carmody <phil at dovecot.fi>
  Date:   2016-04-19 (Tue, 19 Apr 2016)

  Changed paths:
    M src/lib/bits.c
    M src/lib/bits.h

  Log Message:
  -----------
  lib: bits - GCC (and clang) provide bit-twiddle intrinsics, use them

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


  Commit: f2d7ae020bda762f78e8e639a69fb129230cbb7d
      https://github.com/dovecot/core/commit/f2d7ae020bda762f78e8e639a69fb129230cbb7d
  Author: Timo Sirainen <timo.sirainen at dovecot.fi>
  Date:   2016-04-19 (Tue, 19 Apr 2016)

  Changed paths:
    M src/plugins/lazy-expunge/lazy-expunge-plugin.c

  Log Message:
  -----------
  lazy-expunge: Allow lazy_expunge setting to point to a mailbox in any namespace.

This way we can use an existing namespace without having to create a new one
just for a single lazy_expunge mailbox.


  Commit: 3f7fa57941f967df4b8171acbcd022b1b14aad6f
      https://github.com/dovecot/core/commit/3f7fa57941f967df4b8171acbcd022b1b14aad6f
  Author: Timo Sirainen <timo.sirainen at dovecot.fi>
  Date:   2016-04-19 (Tue, 19 Apr 2016)

  Changed paths:
    M src/lib/array.h
    M src/lib/bits.c
    M src/lib/bits.h
    M src/lib/test-array.c
    M src/lib/test-bits.c
    M src/plugins/lazy-expunge/lazy-expunge-plugin.c

  Log Message:
  -----------
  Merge branch 'master' of git.dovecot.net:dovecot/core


Compare: https://github.com/dovecot/core/compare/01b439471351...3f7fa57941f9


More information about the dovecot-cvs mailing list