当前位置: 首页>>代码示例>>C++>>正文


C++ pool_alloconly_create函数代码示例

本文整理汇总了C++中pool_alloconly_create函数的典型用法代码示例。如果您正苦于以下问题:C++ pool_alloconly_create函数的具体用法?C++ pool_alloconly_create怎么用?C++ pool_alloconly_create使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了pool_alloconly_create函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: mailbox_list_subscriptions_iter_init

struct mailbox_list_iterate_context *
mailbox_list_subscriptions_iter_init(struct mailbox_list *list,
                                     const char *const *patterns,
                                     enum mailbox_list_iter_flags flags)
{
    struct subscriptions_mailbox_list_iterate_context *ctx;
    pool_t pool;
    char sep = mail_namespace_get_sep(list->ns);

    pool = pool_alloconly_create("mailbox list subscriptions iter", 1024);
    ctx = p_new(pool, struct subscriptions_mailbox_list_iterate_context, 1);
    ctx->ctx.pool = pool;
    ctx->ctx.list = list;
    ctx->ctx.flags = flags;
    ctx->ctx.glob = imap_match_init_multiple(pool, patterns, TRUE, sep);
    array_create(&ctx->ctx.module_contexts, pool, sizeof(void *), 5);

    ctx->tree = mailbox_tree_init(sep);
    mailbox_list_subscriptions_fill(&ctx->ctx, ctx->tree, FALSE);

    ctx->info.ns = list->ns;
    /* the tree usually has only those entries we want to iterate through,
       but there are also non-matching root entries (e.g. "LSUB foo/%" will
       include the "foo"), which we'll drop with MAILBOX_MATCHED. */
    ctx->iter = mailbox_tree_iterate_init(ctx->tree, NULL, MAILBOX_MATCHED);
    return &ctx->ctx;
}
开发者ID:dhultin,项目名称:dovecot-pop-uidl-proxy,代码行数:27,代码来源:mailbox-list-subscriptions.c

示例2: lmtp_client_init

struct lmtp_client *
lmtp_client_init(const struct lmtp_client_settings *set,
		 lmtp_finish_callback_t *finish_callback, void *context)
{
	struct lmtp_client *client;
	pool_t pool;

	i_assert(*set->mail_from == '<');
	i_assert(*set->my_hostname != '\0');

	pool = pool_alloconly_create("lmtp client", 512);
	client = p_new(pool, struct lmtp_client, 1);
	client->refcount = 1;
	client->pool = pool;
	client->set.mail_from = p_strdup(pool, set->mail_from);
	client->set.my_hostname = p_strdup(pool, set->my_hostname);
	client->set.dns_client_socket_path =
		p_strdup(pool, set->dns_client_socket_path);
	client->set.source_ip = set->source_ip;
	client->set.source_port = set->source_port;
	client->set.proxy_ttl = set->proxy_ttl;
	client->set.proxy_timeout_secs = set->proxy_timeout_secs;
	client->set.timeout_secs = set->timeout_secs;
	client->finish_callback = finish_callback;
	client->finish_context = context;
	client->fd = -1;
	client->input_multiline = str_new(default_pool, 128);
	p_array_init(&client->recipients, pool, 16);
	return client;
}
开发者ID:bechtoldt,项目名称:dovecot-core,代码行数:30,代码来源:lmtp-client.c

示例3: fts_filter_stopwords_create

static int
fts_filter_stopwords_create(const struct fts_language *lang,
                            const char *const *settings,
                            struct fts_filter **filter_r,
                            const char **error_r)
{
	struct fts_filter_stopwords *sp;
	pool_t pp;
	const char *dir = NULL;
	unsigned int i;

	for (i = 0; settings[i] != NULL; i += 2) {
		const char *key = settings[i], *value = settings[i+1];

		if (strcmp(key, "stopwords_dir") == 0) {
			dir = value;
		} else {
			*error_r = t_strdup_printf("Unknown setting: %s", key);
			return -1;
		}
	}
	pp = pool_alloconly_create(MEMPOOL_GROWING"fts_filter_stopwords",
	                           sizeof(struct fts_filter));
	sp = p_new(pp, struct fts_filter_stopwords, 1);
	sp->filter = *fts_filter_stopwords;
	sp->pool = pp;
	sp->lang = p_malloc(sp->pool, sizeof(struct fts_language));
	sp->lang->name = p_strdup(sp->pool, lang->name);
	if (dir != NULL)
		sp->stopwords_dir = p_strdup(pp, dir);
	else
		sp->stopwords_dir = DATADIR"/stopwords";
	*filter_r = &sp->filter;
	return 0;
}
开发者ID:IvanKharpalev,项目名称:core,代码行数:35,代码来源:fts-filter-stopwords.c

示例4: get_metadata_cache_fields

static void
get_metadata_cache_fields(struct mailbox *box,
			  struct mailbox_metadata *metadata_r)
{
	const struct mail_cache_field *fields;
	enum mail_cache_decision_type dec;
	ARRAY_TYPE(mailbox_cache_field) *cache_fields;
	struct mailbox_cache_field *cf;
	unsigned int i, count;

	if (box->metadata_pool == NULL) {
		box->metadata_pool =
			pool_alloconly_create("mailbox metadata", 1024*3);
	}

	fields = mail_cache_register_get_list(box->cache,
					      box->metadata_pool, &count);

	cache_fields = p_new(box->metadata_pool,
			     ARRAY_TYPE(mailbox_cache_field), 1);
	p_array_init(cache_fields, box->metadata_pool, count);
	for (i = 0; i < count; i++) {
		dec = fields[i].decision & ~MAIL_CACHE_DECISION_FORCED;
		if (dec != MAIL_CACHE_DECISION_NO) {
			cf = array_append_space(cache_fields);
			cf->name = fields[i].name;
			cf->decision = fields[i].decision;
			cf->last_used = fields[i].last_used;
		}
	}
	metadata_r->cache_fields = cache_fields;
}
开发者ID:bsmr-dovecot,项目名称:core,代码行数:32,代码来源:index-status.c

示例5: client_connection_create

struct client_connection *
client_connection_create(int fd, int listen_fd, bool ssl)
{
	struct client_connection *conn;
	unsigned int port;
	pool_t pool;

	pool = pool_alloconly_create("doveadm client", 1024*16);
	conn = p_new(pool, struct client_connection, 1);
	conn->pool = pool;
	conn->fd = fd;
	conn->io = io_add(fd, IO_READ, client_connection_input, conn);
	conn->input = i_stream_create_fd(fd, MAX_INBUF_SIZE, FALSE);
	conn->output = o_stream_create_fd(fd, (size_t)-1, FALSE);
	o_stream_set_no_error_handling(conn->output, TRUE);

	(void)net_getsockname(fd, &conn->local_ip, &port);
	(void)net_getpeername(fd, &conn->remote_ip, &port);

	if (client_connection_read_settings(conn) < 0) {
		client_connection_destroy(&conn);
		return NULL;
	}
	if (ssl) {
		if (client_connection_init_ssl(conn) < 0) {
			client_connection_destroy(&conn);
			return NULL;
		}
	}
	client_connection_send_auth_handshake(conn, listen_fd);
	return conn;
}
开发者ID:bdraco,项目名称:dovecot,代码行数:32,代码来源:client-connection.c

示例6: test_mempool_alloconly

void test_mempool_alloconly(void)
{
#define PMALLOC_MAX_COUNT 128
    pool_t pool;
    unsigned int i, j, k;
    void *mem[PMALLOC_MAX_COUNT + 1];
    bool success = TRUE;

    for (i = 0; i < 64; i++) {
        for (j = 1; j <= 128; j++) {
            pool = pool_alloconly_create(MEMPOOL_GROWING"test", i);
            mem[0] = p_malloc(pool, j);
            memset(mem[0], j, j);

            for (k = 1; k <= PMALLOC_MAX_COUNT; k++) {
                mem[k] = p_malloc(pool, k);
                memset(mem[k], k, k);
            }

            if (!mem_has_bytes(mem[0], j, j))
                success = FALSE;
            for (k = 1; k <= PMALLOC_MAX_COUNT; k++) {
                if (!mem_has_bytes(mem[k], k, k))
                    success = FALSE;
            }
            pool_unref(&pool);
        }
    }
    test_out("mempool_alloconly", success);
}
开发者ID:dhultin,项目名称:dovecot-pop-uidl-proxy,代码行数:30,代码来源:test-mempool-alloconly.c

示例7: imap_master_client_input_line

static int
imap_master_client_input_line(struct connection *conn, const char *line)
{
	char *const *args;
	pool_t pool;
	int fd_client, ret;

	if (!conn->version_received) {
		if (connection_verify_version(conn, t_strsplit_tabescaped(line)) < 0)
			return -1;
		conn->version_received = TRUE;
		return 1;
	}

	fd_client = i_stream_unix_get_read_fd(conn->input);
	if (fd_client == -1) {
		i_error("imap-master: IMAP client fd not received");
		return -1;
	}

	if (imap_debug)
		i_debug("imap-master: Client input: %s", line);

	pool = pool_alloconly_create("imap master client cmd", 1024);
	args = p_strsplit_tabescaped(pool, line);
	ret = imap_master_client_input_args(conn, (void *)args, fd_client, pool);
	pool_unref(&pool);
	return ret;
}
开发者ID:bdraco,项目名称:core,代码行数:29,代码来源:imap-master-client.c

示例8: hash_format_init

int hash_format_init(const char *format_string, struct hash_format **format_r,
		     const char **error_r)
{
	struct hash_format *format;
	pool_t pool;
	int ret;

	pool = pool_alloconly_create("hash format", 1024);
	format = p_new(pool, struct hash_format, 1);
	format->pool = pool;
	format->str = p_strdup(pool, format_string);
	format->pos = &format->list;
	T_BEGIN {
		ret = hash_format_string_analyze(format, format_string,
						 error_r);
		if (ret < 0)
			*error_r = p_strdup(format->pool, *error_r);
	} T_END;
	if (ret < 0) {
		*error_r = t_strdup(*error_r);
		pool_unref(&pool);
		return -1;
	}
	*format_r = format;
	return 0;
}
开发者ID:Raffprta,项目名称:core,代码行数:26,代码来源:hash-format.c

示例9: maildir_save_transaction_init

static struct mail_save_context *
maildir_save_transaction_init(struct mailbox_transaction_context *t)
{
	struct maildir_mailbox *mbox = (struct maildir_mailbox *)t->box;
	struct maildir_save_context *ctx;
	const char *path;
	pool_t pool;

	pool = pool_alloconly_create("maildir_save_context", 4096);
	ctx = p_new(pool, struct maildir_save_context, 1);
	ctx->ctx.transaction = t;
	ctx->pool = pool;
	ctx->mbox = mbox;
	ctx->trans = t->itrans;
	ctx->files_tail = &ctx->files;
	ctx->fd = -1;

	path = mailbox_get_path(&mbox->box);
	ctx->tmpdir = p_strconcat(pool, path, "/tmp", NULL);
	ctx->newdir = p_strconcat(pool, path, "/new", NULL);
	ctx->curdir = p_strconcat(pool, path, "/cur", NULL);

	buffer_create_from_const_data(&ctx->keywords_buffer, "", 0);
	array_create_from_buffer(&ctx->keywords_array, &ctx->keywords_buffer,
				 sizeof(unsigned int));
	ctx->last_save_finished = TRUE;
	return &ctx->ctx;
}
开发者ID:Raffprta,项目名称:core,代码行数:28,代码来源:maildir-save.c

示例10: pool_alloconly_create

struct sieve_generator *sieve_generator_create
(struct sieve_ast *ast, struct sieve_error_handler *ehandler,
	enum sieve_compile_flags flags)
{
	pool_t pool;
	struct sieve_generator *gentr;
	struct sieve_script *script;
	struct sieve_instance *svinst;

	pool = pool_alloconly_create("sieve_generator", 4096);
	gentr = p_new(pool, struct sieve_generator, 1);
	gentr->pool = pool;

	gentr->ehandler = ehandler;
	sieve_error_handler_ref(ehandler);

	gentr->genenv.gentr = gentr;
	gentr->genenv.flags = flags;
	gentr->genenv.ast = ast;
	sieve_ast_ref(ast);

	script = sieve_ast_script(ast);
	svinst = sieve_script_svinst(script);

	gentr->genenv.script = script;
	gentr->genenv.svinst = svinst;

	/* Setup storage for extension contexts */
	p_array_init(&gentr->ext_contexts, pool, sieve_extensions_get_count(svinst));

	return gentr;
}
开发者ID:aclindsa,项目名称:pigeonhole,代码行数:32,代码来源:sieve-generator.c

示例11: maildir_keywords_init_readonly

struct maildir_keywords *
maildir_keywords_init_readonly(struct mailbox *box)
{
	struct maildir_keywords *mk;
	const char *dir;

	if (mailbox_get_path_to(box, MAILBOX_LIST_PATH_TYPE_CONTROL, &dir) <= 0)
		i_unreached();

	mk = i_new(struct maildir_keywords, 1);
	mk->storage = box->storage;
	mk->path = i_strconcat(dir, "/" MAILDIR_KEYWORDS_NAME, NULL);
	mk->pool = pool_alloconly_create("maildir keywords", 512);
	i_array_init(&mk->list, MAILDIR_MAX_KEYWORDS);
	hash_table_create(&mk->hash, mk->pool, 0, strcase_hash, strcasecmp);

	mk->dotlock_settings.use_excl_lock =
		box->storage->set->dotlock_use_excl;
	mk->dotlock_settings.nfs_flush =
		box->storage->set->mail_nfs_storage;
	mk->dotlock_settings.timeout =
		mail_storage_get_lock_timeout(box->storage,
					      KEYWORDS_LOCK_STALE_TIMEOUT + 2);
	mk->dotlock_settings.stale_timeout = KEYWORDS_LOCK_STALE_TIMEOUT;
	mk->dotlock_settings.temp_prefix =
		mailbox_list_get_temp_prefix(box->list);
	return mk;
}
开发者ID:bsmr-dovecot,项目名称:core,代码行数:28,代码来源:maildir-keywords.c

示例12: index_mail_init

void index_mail_init(struct index_mail *mail,
		     struct mailbox_transaction_context *_t,
		     enum mail_fetch_field wanted_fields,
		     struct mailbox_header_lookup_ctx *_wanted_headers)
{
	struct index_transaction_context *t =
		(struct index_transaction_context *)_t;
	struct index_header_lookup_ctx *wanted_headers =
		(struct index_header_lookup_ctx *)_wanted_headers;
	const struct mail_index_header *hdr;

	array_create(&mail->mail.module_contexts, mail->mail.pool,
		     sizeof(void *), 5);

	mail->mail.v = *_t->box->mail_vfuncs;
	mail->mail.mail.box = _t->box;
	mail->mail.mail.transaction = &t->mailbox_ctx;
	mail->mail.wanted_fields = wanted_fields;
	mail->mail.wanted_headers = _wanted_headers;

	hdr = mail_index_get_header(_t->box->view);
	mail->uid_validity = hdr->uid_validity;

	t->mail_ref_count++;
	mail->data_pool = pool_alloconly_create("index_mail", 16384);
	mail->ibox = INDEX_STORAGE_CONTEXT(_t->box);
	mail->trans = t;
	mail->wanted_fields = wanted_fields;
	if (wanted_headers != NULL) {
		mail->wanted_headers = wanted_headers;
		mailbox_header_lookup_ref(_wanted_headers);
	}
}
开发者ID:via,项目名称:dovecot-clouddb,代码行数:33,代码来源:index-mail.c

示例13: fts_filter_stemmer_snowball_create

static int
fts_filter_stemmer_snowball_create(const struct fts_language *lang,
                                   const char *const *settings,
                                   struct fts_filter **filter_r,
                                   const char **error_r)
{
    struct fts_filter_stemmer_snowball *sp;
    pool_t pp;

    *filter_r = NULL;

    if (settings[0] != NULL) {
        *error_r = t_strdup_printf("Unknown setting: %s", settings[0]);
        return -1;
    }
    pp = pool_alloconly_create(MEMPOOL_GROWING"fts_filter_stemmer_snowball",
                               sizeof(struct fts_filter));
    sp = p_new(pp, struct fts_filter_stemmer_snowball, 1);
    sp->pool = pp;
    sp->filter = *fts_filter_stemmer_snowball;
    sp->lang = p_malloc(sp->pool, sizeof(struct fts_language));
    sp->lang->name = p_strdup(sp->pool, lang->name);
    *filter_r = &sp->filter;
    return 0;
}
开发者ID:jfsmig,项目名称:dovecot-core,代码行数:25,代码来源:fts-filter-stemmer-snowball.c

示例14: mbox_mailbox_alloc

static struct mailbox *
mbox_mailbox_alloc(struct mail_storage *storage, struct mailbox_list *list,
		   const char *vname, enum mailbox_flags flags)
{
	struct mbox_mailbox *mbox;
	pool_t pool;

	pool = pool_alloconly_create("mbox mailbox", 1024*3);
	mbox = p_new(pool, struct mbox_mailbox, 1);
	mbox->box = mbox_mailbox;
	mbox->box.pool = pool;
	mbox->box.storage = storage;
	mbox->box.list = list;
	mbox->box.mail_vfuncs = &mbox_mail_vfuncs;

	index_storage_mailbox_alloc(&mbox->box, vname, flags, MAIL_INDEX_PREFIX);

	mbox->storage = (struct mbox_storage *)storage;
	mbox->mbox_fd = -1;
	mbox->mbox_lock_type = F_UNLCK;
	mbox->mbox_list_index_ext_id = (uint32_t)-1;

	if (strcmp(mbox->storage->set->mbox_md5, "apop3d") == 0)
		mbox->md5_v = mbox_md5_apop3d;
	else if (strcmp(mbox->storage->set->mbox_md5, "all") == 0)
		mbox->md5_v = mbox_md5_all;
	else {
		i_fatal("Invalid mbox_md5 setting: %s",
			mbox->storage->set->mbox_md5);
	}

	if ((storage->flags & MAIL_STORAGE_FLAG_KEEP_HEADER_MD5) != 0)
		mbox->mbox_save_md5 = TRUE;
	return &mbox->box;
}
开发者ID:IvanKharpalev,项目名称:core,代码行数:35,代码来源:mbox-storage.c

示例15: i_assert

struct mail_user *mail_user_alloc(const char *username,
				  const struct setting_parser_info *set_info,
				  const struct mail_user_settings *set)
{
	struct mail_user *user;
	const char *error;
	pool_t pool;

	i_assert(username != NULL);
	i_assert(*username != '\0');

	pool = pool_alloconly_create(MEMPOOL_GROWING"mail user", 16*1024);
	user = p_new(pool, struct mail_user, 1);
	user->pool = pool;
	user->refcount = 1;
	user->username = p_strdup(pool, username);
	user->set_info = set_info;
	user->unexpanded_set = settings_dup(set_info, set, pool);
	user->set = settings_dup(set_info, set, pool);
	user->service = master_service_get_name(master_service);
	user->default_normalizer = uni_utf8_to_decomposed_titlecase;

	/* check settings so that the duplicated structure will again
	   contain the parsed fields */
	if (!settings_check(set_info, pool, user->set, &error))
		i_panic("Settings check unexpectedly failed: %s", error);

	user->v.deinit = mail_user_deinit_base;
	user->v.stats_fill = mail_user_stats_fill_base;
	p_array_init(&user->module_contexts, user->pool, 5);
	return user;
}
开发者ID:LTD-Beget,项目名称:dovecot,代码行数:32,代码来源:mail-user.c


注:本文中的pool_alloconly_create函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。