~james-page/ubuntu/raring/dovecot/autopkgtest

« back to all changes in this revision

Viewing changes to src/lib/strfuncs.c

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2012-06-11 11:11:54 UTC
  • mfrom: (1.15.2) (4.1.27 sid)
  • Revision ID: package-import@ubuntu.com-20120611111154-678cwbdj6ktgsv1h
Tags: 1:2.1.7-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/{control,rules}: enable PIE hardening.
  + 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.
  + d/control: Added Pre-Depends: dpkg (>= 1.15.6) to dovecot-dbg to support
    xz compression in Ubuntu.
  + d/control: Demote dovecot-common Recommends: to Suggests: to prevent
    install of extra packages on upgrade.
  + d/patches/dovecot-drac.patch: Updated with version for dovecot >= 2.0.0.
  + d/control: Drop B-D on systemd.
* Dropped changes:
  + d/patches/fix-racey-restart.patch: part of 2.1.x, no longer required.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (c) 2002-2011 Dovecot authors, see the included COPYING file */
 
1
/* Copyright (c) 2002-2012 Dovecot authors, see the included COPYING file */
2
2
 
3
3
/* @UNSAFE: whole file */
4
4
 
313
313
 
314
314
const char *t_str_lcase(const char *str)
315
315
{
 
316
        i_assert(str != NULL);
 
317
 
316
318
        return str_lcase(t_strdup_noconst(str));
317
319
}
318
320
 
319
321
const char *t_str_ucase(const char *str)
320
322
{
 
323
        i_assert(str != NULL);
 
324
 
321
325
        return str_ucase(t_strdup_noconst(str));
322
326
}
323
327
 
459
463
        return split_str(pool, data, separators, TRUE);
460
464
}
461
465
 
 
466
const char **t_strsplit_tab(const char *data)
 
467
{
 
468
        const char **array;
 
469
        char *dest;
 
470
        unsigned int i, array_idx, array_size, dest_size;
 
471
 
 
472
        if (*data == '\0')
 
473
                return t_new(const char *, 1);
 
474
 
 
475
        array_size = 1;
 
476
        dest_size = 128;
 
477
        dest = t_buffer_get(dest_size+1);
 
478
        for (i = 0; data[i] != '\0'; i++) {
 
479
                if (i >= dest_size) {
 
480
                        dest_size = nearest_power(dest_size+1);
 
481
                        dest = t_buffer_reget(dest, dest_size+1);
 
482
                }
 
483
                if (data[i] != '\t')
 
484
                        dest[i] = data[i];
 
485
                else {
 
486
                        dest[i] = '\0';
 
487
                        array_size++;
 
488
                }
 
489
        }
 
490
        i_assert(i <= dest_size);
 
491
        dest[i] = '\0';
 
492
        t_buffer_alloc(i+1);
 
493
        dest_size = i;
 
494
 
 
495
        array = t_new(const char *, array_size + 1);
 
496
        array[0] = dest; array_idx = 1;
 
497
 
 
498
        for (i = 0; i < dest_size; i++) {
 
499
                if (dest[i] == '\0')
 
500
                        array[array_idx++] = dest+i+1;
 
501
        }
 
502
        i_assert(array_idx == array_size);
 
503
        array[array_idx] = NULL;
 
504
        return array;
 
505
}
 
506
 
462
507
void p_strsplit_free(pool_t pool, char **arr)
463
508
{
464
509
        p_free(pool, arr[0]);