~ubuntu-branches/ubuntu/utopic/dovecot/utopic-proposed

« back to all changes in this revision

Viewing changes to src/lib/array.h

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-01-08 09:35:49 UTC
  • mfrom: (4.1.35 sid)
  • Revision ID: package-import@ubuntu.com-20140108093549-i72o93pux8p0dlaf
Tags: 1:2.2.9-1ubuntu1
* Merge from Debian unstable, remaining changes:
  + Add mail-stack-delivery package:
    - Update d/rules
    - d/control: convert existing dovecot-postfix package to a dummy
      package and add new mail-stack-delivery package.
    - Update maintainer scripts.
    - Rename d/dovecot-postfix.* to debian/mail-stack-delivery.*
    - d/mail-stack-delivery.preinst: Move previously installed backups and
      config files to a new package namespace.
    - d/mail-stack-delivery.prerm: Added to handle downgrades.
  + Use Snakeoil SSL certificates by default:
    - d/control: Depend on ssl-cert.
    - d/dovecot-core.postinst: Relax grep for SSL_* a bit.
  + Add autopkgtest to debian/tests/*.
  + Add ufw integration:
    - d/dovecot-core.ufw.profile: new ufw profile.
    - d/rules: install profile in dovecot-core.
    - d/control: dovecot-core - suggest ufw.
  + d/dovecot-core.dirs: Added usr/share/doc/dovecot-core
  + Add apport hook:
    - d/rules, d/source_dovecot.py
  + Add upstart job:
    - d/rules, d/dovecot-core.dovecot.upstart, d/control,
      d/dovecot-core.dirs, dovecot-imapd.{postrm, postinst, prerm},
      d/dovecot-pop3d.{postinst, postrm, prerm}.
      d/mail-stack-deliver.postinst: Convert init script to upstart.
  + Use the autotools-dev dh addon to update config.guess/config.sub for
    arm64.
* Dropped changes, included in Debian:
  - Update Dovecot name to reflect distribution in login greeting.
  - Update Drac plugin for >= 2.0.0 support.
* d/control: Drop dovecot-postfix package as its no longer required.

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
   Example usage:
10
10
 
11
11
   struct foo {
12
 
        ARRAY_DEFINE(bars, struct bar);
 
12
        ARRAY(struct bar) bars;
13
13
        ...
14
14
   };
15
15
 
235
235
}
236
236
#define array_append_space(array) \
237
237
        ARRAY_TYPE_CAST_MODIFIABLE(array)array_append_space_i(&(array)->arr)
 
238
#define array_append_zero(array) \
 
239
        (void)array_append_space_i(&(array)->arr)
238
240
 
239
241
void *array_insert_space_i(struct array *array, unsigned int idx);
240
242
#define array_insert_space(array, idx) \
262
264
        array_reverse_i(&(array)->arr)
263
265
 
264
266
void array_sort_i(struct array *array, int (*cmp)(const void *, const void *));
265
 
#ifdef CONTEXT_TYPE_SAFETY
266
 
#define array_sort(array, cmp) \
267
 
        ({(void)(1 ? 0 : cmp(ARRAY_TYPE_CAST_CONST(array)NULL, \
268
 
                             ARRAY_TYPE_CAST_CONST(array)NULL)); \
269
 
        array_sort_i(&(array)->arr, \
270
 
                (int (*)(const void *, const void *))cmp); })
271
 
#else
272
 
#define array_sort(array, cmp) \
273
 
        array_sort_i(&(array)->arr, (int (*)(const void *, const void *))cmp)
274
 
#endif
 
267
#define array_sort(array, cmp) \
 
268
        array_sort_i(&(array)->arr + \
 
269
                CALLBACK_TYPECHECK(cmp, int (*)(typeof(*(array)->v), \
 
270
                                                typeof(*(array)->v))), \
 
271
                (int (*)(const void *, const void *))cmp)
275
272
 
276
273
void *array_bsearch_i(struct array *array, const void *key,
277
274
                      int (*cmp)(const void *, const void *));
278
 
#ifdef CONTEXT_TYPE_SAFETY
279
 
#define array_bsearch(array, key, cmp) \
280
 
        ARRAY_TYPE_CAST_MODIFIABLE(array) \
281
 
        ({(void)(1 ? 0 : cmp(key, ARRAY_TYPE_CAST_CONST(array)NULL)); \
282
 
        array_bsearch_i(&(array)->arr, (const void *)key, \
283
 
                (int (*)(const void *, const void *))cmp); })
284
 
#else
285
 
#define array_bsearch(array, key, cmp) \
286
 
        array_bsearch_i(&(array)->arr, (const void *)key, \
287
 
                (int (*)(const void *, const void *))cmp)
288
 
#endif
 
275
#define array_bsearch(array, key, cmp) \
 
276
        ARRAY_TYPE_CAST_MODIFIABLE(array)array_bsearch_i(&(array)->arr + \
 
277
                CALLBACK_TYPECHECK(cmp, int (*)(typeof(const typeof(*key) *), \
 
278
                                                typeof(*(array)->v))), \
 
279
                (const void *)key, (int (*)(const void *, const void *))cmp)
289
280
 
290
281
#endif