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


C++ pool_unref函数代码示例

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


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

示例1: stats_top

static void stats_top(const char *path, const char *sort_type)
{
	struct top_context ctx;

	memset(&ctx, 0, sizeof(ctx));
	ctx.path = path;
	ctx.fd = doveadm_connect(path);
	ctx.prev_pool = pool_alloconly_create("stats top", 1024*16);
	ctx.cur_pool = pool_alloconly_create("stats top", 1024*16);
	i_array_init(&ctx.lines, 128);
	hash_table_create(&ctx.sessions, default_pool, 0, str_hash, strcmp);
	net_set_nonblock(ctx.fd, FALSE);

	ctx.input = i_stream_create_fd(ctx.fd, (size_t)-1, TRUE);

	if (strstr(sort_type, "cpu") != NULL)
		ctx.lines_sort = sort_cpu;
	else
		ctx.lines_sort = sort_num;
	ctx.sort_type = sort_type;

	stats_top_start(&ctx);
	i_stream_destroy(&ctx.input);
	hash_table_destroy(&ctx.sessions);
	array_free(&ctx.lines);
	pool_unref(&ctx.prev_pool);
	pool_unref(&ctx.cur_pool);
	i_close_fd(&ctx.fd);
}
开发者ID:dhultin,项目名称:dovecot-pop-uidl-proxy,代码行数:29,代码来源:doveadm-stats.c

示例2: index_mail_free

void index_mail_free(struct mail *_mail)
{
	struct index_mail *mail = (struct index_mail *)_mail;
	struct mailbox_header_lookup_ctx *headers_ctx =
		(struct mailbox_header_lookup_ctx *)mail->wanted_headers;

	mail->mail.v.close(_mail);

	i_assert(mail->trans->mail_ref_count > 0);
	mail->trans->mail_ref_count--;

	if (mail->header_data != NULL)
		buffer_free(&mail->header_data);
	if (array_is_created(&mail->header_lines))
		array_free(&mail->header_lines);
	if (array_is_created(&mail->header_match))
		array_free(&mail->header_match);
	if (array_is_created(&mail->header_match_lines))
		array_free(&mail->header_match_lines);

	if (headers_ctx != NULL)
		mailbox_header_lookup_unref(&headers_ctx);
	pool_unref(&mail->data_pool);
	pool_unref(&mail->mail.pool);
}
开发者ID:via,项目名称:dovecot-clouddb,代码行数:25,代码来源:index-mail.c

示例3: acl_backend_vfile_deinit

static void acl_backend_vfile_deinit(struct acl_backend *_backend)
{
	struct acl_backend_vfile *backend =
		(struct acl_backend_vfile *)_backend;

	if (backend->acllist_pool != NULL) {
		array_free(&backend->acllist);
		pool_unref(&backend->acllist_pool);
	}
	if (_backend->global_file != NULL)
		acl_global_file_deinit(&_backend->global_file);
	pool_unref(&backend->backend.pool);
}
开发者ID:dhultin,项目名称:dovecot-pop-uidl-proxy,代码行数:13,代码来源:acl-backend-vfile.c

示例4: mailbox_list_index_iter_deinit

int mailbox_list_index_iter_deinit(struct mailbox_list_iterate_context *_ctx)
{
	struct mailbox_list_index *ilist = INDEX_LIST_CONTEXT_REQUIRE(_ctx->list);
	if (!_ctx->index_iteration)
		return ilist->module_ctx.super.iter_deinit(_ctx);

	struct mailbox_list_index_iterate_context *ctx =
		(struct mailbox_list_index_iterate_context *)_ctx;
	int ret = ctx->failed ? -1 : 0;

	pool_unref(&ctx->mailbox_pool);
	pool_unref(&ctx->info_pool);
	pool_unref(&_ctx->pool);
	return ret;
}
开发者ID:bdraco,项目名称:core,代码行数:15,代码来源:mailbox-list-index-iter.c

示例5: hash_format_deinit_free

void hash_format_deinit_free(struct hash_format **_format)
{
	struct hash_format *format = *_format;

	*_format = NULL;
	pool_unref(&format->pool);
}
开发者ID:Raffprta,项目名称:core,代码行数:7,代码来源:hash-format.c

示例6: 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

示例7: 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

示例8: 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

示例9: smtp_server_command_unref

bool smtp_server_command_unref(struct smtp_server_command **_cmd)
{
	struct smtp_server_command *cmd = *_cmd;
	struct smtp_server_connection *conn = cmd->context.conn;

	*_cmd = NULL;

	i_assert(cmd->refcount > 0);
	if (--cmd->refcount > 0)
		return TRUE;

	smtp_server_command_debug(&cmd->context, "Destroy");

	if (cmd->state < SMTP_SERVER_COMMAND_STATE_FINISHED) {
		cmd->state = SMTP_SERVER_COMMAND_STATE_ABORTED;
		DLLIST2_REMOVE(&conn->command_queue_head,
			&conn->command_queue_tail, cmd);
		conn->command_queue_count--;
	}

	/* execute hooks */
	if (cmd->context.hook_destroy != NULL)
		cmd->context.hook_destroy(&cmd->context);
	if (cmd->hook_destroy != NULL)
		cmd->hook_destroy(&cmd->context);

	smtp_server_reply_free(cmd);
	pool_unref(&cmd->context.pool);
	return FALSE;
}
开发者ID:bdraco,项目名称:core,代码行数:30,代码来源:smtp-server-command.c

示例10: fatal_mempool

enum fatal_test_state fatal_mempool(int stage)
{
	static pool_t pool;

	switch(stage) {
	case 0: /* forbidden size */
		test_begin("fatal_mempool");
		pool = pool_alloconly_create(MEMPOOL_GROWING"fatal", 1);
		(void)p_malloc(pool, 0);
		return FATAL_TEST_FAILURE;

	case 1: /* logically impossible size */
		(void)p_malloc(pool, SSIZE_T_MAX + 1ULL);
		return FATAL_TEST_FAILURE;

	case 2: /* physically impossible size */
		(void)p_malloc(pool, SSIZE_T_MAX - (size_t)MEM_ALIGN(1));
		return FATAL_TEST_FAILURE;

	/* Continue with other tests as follows:
	case 3:
		something_fatal();
		return FATAL_TEST_FAILURE;
	*/
	}

	/* Either our tests have finished, or the test suite has got confused. */
	pool_unref(&pool);
	test_end();
	return FATAL_TEST_FINISHED;
}
开发者ID:Raffprta,项目名称:core,代码行数:31,代码来源:test-mempool-alloconly.c

示例11: doveadm_mail_cmd_server_run

static void
doveadm_mail_cmd_server_run(struct client_connection *conn,
			    struct doveadm_mail_cmd_context *ctx,
			    const struct mail_storage_service_input *input)
{
	const char *error;
	int ret;

	ctx->conn = conn;

	if (ctx->v.preinit != NULL)
		ctx->v.preinit(ctx);

	ret = doveadm_mail_single_user(ctx, input, &error);
	doveadm_mail_server_flush();
	ctx->v.deinit(ctx);
	doveadm_print_flush();
	mail_storage_service_deinit(&ctx->storage_service);

	if (ret < 0) {
		i_error("%s: %s", ctx->cmd->name, error);
		o_stream_nsend(conn->output, "\n-\n", 3);
	} else if (ret == 0) {
		o_stream_nsend_str(conn->output, "\n-NOUSER\n");
	} else if (ctx->exit_code != 0) {
		/* maybe not an error, but not a full success either */
		o_stream_nsend_str(conn->output,
				   t_strdup_printf("\n-%u\n", ctx->exit_code));
	} else {
		o_stream_nsend(conn->output, "\n+\n", 3);
	}
	pool_unref(&ctx->pool);
}
开发者ID:bsmr-dovecot,项目名称:core,代码行数:33,代码来源:client-connection.c

示例12: i_assert

int sieve_file_storage_save_commit
(struct sieve_storage_save_context *sctx)
{
	struct sieve_file_save_context *fsctx =
		(struct sieve_file_save_context *)sctx;
	struct sieve_storage *storage = sctx->storage;
	struct sieve_file_storage *fstorage =
		(struct sieve_file_storage *)sctx->storage;
	const char *dest_path;
	bool failed = FALSE;

	i_assert(fsctx->output == NULL);

	T_BEGIN {
		dest_path = t_strconcat(fstorage->path, "/",
			sieve_script_file_from_name(sctx->scriptname), NULL);

		failed = ( sieve_file_storage_script_move(fsctx, dest_path) < 0 );
		if ( sctx->mtime != (time_t)-1 )
			sieve_file_storage_update_mtime(storage, dest_path, sctx->mtime);
	} T_END;

	pool_unref(&sctx->pool);
	
	return ( failed ? -1 : 0 );
}
开发者ID:dovecot,项目名称:pigeonhole,代码行数:26,代码来源:sieve-file-storage-save.c

示例13: test_imap_match_globs_equal

static void test_imap_match_globs_equal(void)
{
	struct imap_match_glob *glob;
	pool_t pool;

	pool = pool_alloconly_create("imap match globs equal", 1024);
	test_begin("imap match globs equal");

	glob = imap_match_init(pool, "1", FALSE, '/');
	test_assert(imap_match_globs_equal(glob,
		imap_match_init(pool, "1", FALSE, '/')));
	test_assert(imap_match_globs_equal(glob,
		imap_match_init(pool, "1", TRUE, '/')));
	test_assert(!imap_match_globs_equal(glob,
		imap_match_init(pool, "1", FALSE, '.')));
	test_assert(!imap_match_globs_equal(glob,
		imap_match_init(pool, "11", FALSE, '/')));

	glob = imap_match_init(pool, "in%", TRUE, '/');
	test_assert(!imap_match_globs_equal(glob,
		imap_match_init(pool, "in%", FALSE, '/')));
	test_assert(!imap_match_globs_equal(glob,
		imap_match_init(pool, "In%", TRUE, '/')));

	pool_unref(&pool);
	test_end();
}
开发者ID:LTD-Beget,项目名称:dovecot,代码行数:27,代码来源:test-imap-match.c

示例14: config_export_free

static void config_export_free(struct config_export_context *ctx)
{
	if (ctx->dup_parsers != NULL)
		config_filter_parsers_free(ctx->dup_parsers);
	hash_table_destroy(&ctx->keys);
	pool_unref(&ctx->pool);
}
开发者ID:Distrotech,项目名称:dovecot,代码行数:7,代码来源:config-request.c

示例15: dict_transaction_memory_rollback

void dict_transaction_memory_rollback(struct dict_transaction_context *_ctx)
{
	struct dict_transaction_memory_context *ctx =
		(struct dict_transaction_memory_context *)_ctx;

	pool_unref(&ctx->pool);
}
开发者ID:dhultin,项目名称:dovecot-pop-uidl-proxy,代码行数:7,代码来源:dict-transaction-memory.c


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