本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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 );
}
示例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();
}
示例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);
}
示例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);
}