if (--conn->refcount > 0)
return;
- if (conn->input != NULL)
- i_stream_unref(&conn->input);
- if (conn->output != NULL)
- o_stream_unref(&conn->output);
+ i_stream_unref(&conn->input);
+ o_stream_unref(&conn->output);
i_free(conn->path);
i_free(conn);
if (--conn->refcount > 0)
return;
- if (conn->input != NULL)
- i_stream_unref(&conn->input);
- if (conn->output != NULL)
- o_stream_unref(&conn->output);
+ i_stream_unref(&conn->input);
+ o_stream_unref(&conn->output);
i_free(conn);
}
static void doveadm_mail_cmd_free(struct doveadm_mail_cmd_context *ctx)
{
- if (ctx->users_list_input != NULL)
- i_stream_unref(&ctx->users_list_input);
- if (ctx->cmd_input != NULL)
- i_stream_unref(&ctx->cmd_input);
+ i_stream_unref(&ctx->users_list_input);
+ i_stream_unref(&ctx->cmd_input);
pool_unref(&ctx->pool);
}
if (dsync_mailbox_import_attribute(brain->box_importer, attr) < 0)
brain->failed = TRUE;
input = attr->value_stream;
- if (input != NULL)
- i_stream_unref(&input);
+ i_stream_unref(&input);
return TRUE;
}
}
if (dsync_mailbox_import_mail(brain->box_importer, mail) < 0)
brain->failed = TRUE;
- if (mail->input != NULL)
- i_stream_unref(&mail->input);
+ i_stream_unref(&mail->input);
return TRUE;
}
break;
}
if ((value.flags & MAIL_ATTRIBUTE_VALUE_FLAG_READONLY) != 0) {
- if (value.value_stream != NULL)
- i_stream_unref(&value.value_stream);
+ i_stream_unref(&value.value_stream);
continue;
}
if (exporter->error != NULL)
return -1;
- if (exporter->attr.value_stream != NULL)
- i_stream_unref(&exporter->attr.value_stream);
+ i_stream_unref(&exporter->attr.value_stream);
if (exporter->attr_iter != NULL) {
ret = dsync_mailbox_export_iter_next_attr(exporter);
if (exporter->wanted_headers != NULL)
mailbox_header_lookup_unref(&exporter->wanted_headers);
- if (exporter->attr.value_stream != NULL)
- i_stream_unref(&exporter->attr.value_stream);
+ i_stream_unref(&exporter->attr.value_stream);
hash_table_destroy(&exporter->export_guids);
hash_table_destroy(&exporter->changes);
o_stream_set_flush_callback(ctx->client->output,
client_output, ctx->client);
- if (ctx->litinput != NULL)
- i_stream_unref(&ctx->litinput);
- if (ctx->input != NULL)
- i_stream_unref(&ctx->input);
+ i_stream_unref(&ctx->litinput);
+ i_stream_unref(&ctx->input);
if (ctx->save_ctx != NULL)
mailbox_save_cancel(&ctx->save_ctx);
if (ctx->t != NULL)
skip this entry */
if (ctx->largest_seen_size < value_len)
ctx->largest_seen_size = value_len;
- if (value.value_stream != NULL)
- i_stream_unref(&value.value_stream);
+ i_stream_unref(&value.value_stream);
return;
}
return;
ctx->finished = TRUE;
- if (ctx->input != NULL)
- i_stream_unref(&ctx->input);
+ i_stream_unref(&ctx->input);
if (ctx->ufetch != NULL)
imap_urlauth_fetch_deinit(&ctx->ufetch);
if (state->cur_str != NULL)
str_free(&state->cur_str);
- if (state->cur_input != NULL)
- i_stream_unref(&state->cur_input);
+ i_stream_unref(&state->cur_input);
if (state->search_ctx != NULL) {
if (mailbox_search_deinit(&state->search_ctx) < 0)
{
struct metawrap_fs_file *file = (struct metawrap_fs_file *)_file;
- if (file->input != NULL)
- i_stream_unref(&file->input);
+ i_stream_unref(&file->input);
if (file->super_read != NULL)
fs_file_close(file->super_read);
if (_file->parent != NULL)
{
struct sis_fs_file *file = (struct sis_fs_file *)_file;
- if (file->hash_input != NULL)
- i_stream_unref(&file->hash_input);
+ i_stream_unref(&file->hash_input);
fs_file_close(file->hash_file);
fs_file_close(_file->parent);
}
test_assert_idx(fs_stat(file, &st) == 0 && st.st_size == 20, i);
- if (input != NULL)
- i_stream_unref(&input);
+ i_stream_unref(&input);
fs_file_deinit(&file);
}
fs_deinit(&fs);
if (req->delayed_error != NULL)
http_client_remove_request_error(req->client, req);
- if (req->payload_input != NULL)
- i_stream_unref(&req->payload_input);
- if (req->payload_output != NULL)
- o_stream_unref(&req->payload_output);
+ i_stream_unref(&req->payload_input);
+ o_stream_unref(&req->payload_output);
if (req->headers != NULL)
str_free(&req->headers);
pool_unref(&req->pool);
return FALSE;
} else {
/* release payload early (prevents server/client deadlock in proxy) */
- if (req->payload_input != NULL)
- i_stream_unref(&req->payload_input);
+ i_stream_unref(&req->payload_input);
}
}
return TRUE;
}
/* drop payload output stream from previous attempt */
- if (req->payload_output != NULL)
- o_stream_unref(&req->payload_output);
+ o_stream_unref(&req->payload_output);
target = http_url_create_target(url);
req->method = p_strdup(req->pool, "GET");
/* drop payload */
- if (req->payload_input != NULL)
- i_stream_unref(&req->payload_input);
+ i_stream_unref(&req->payload_input);
req->payload_size = 0;
req->payload_offset = 0;
}
}
/* drop payload output stream from previous attempt */
- if (req->payload_output != NULL)
- o_stream_unref(&req->payload_output);
+ o_stream_unref(&req->payload_output);
req->peer = NULL;
req->state = HTTP_REQUEST_STATE_QUEUED;
http_header_parser_deinit(&parser->header_parser);
if (parser->msg.pool != NULL)
pool_unref(&parser->msg.pool);
- if (parser->payload != NULL)
- i_stream_unref(&parser->payload);
- if (parser->input != NULL)
- i_stream_unref(&parser->input);
+ i_stream_unref(&parser->payload);
+ i_stream_unref(&parser->input);
}
void http_message_parser_restart(struct http_message_parser *parser,
i_assert(!resp->payload_blocking);
- if (resp->payload_input != NULL)
- i_stream_unref(&resp->payload_input);
- if (resp->payload_output != NULL)
- o_stream_unref(&resp->payload_output);
+ i_stream_unref(&resp->payload_input);
+ o_stream_unref(&resp->payload_output);
str_free(&resp->headers);
}
test_client_request_destroy(struct test_client_request *tcreq)
{
io_remove(&tcreq->io);
- if (tcreq->payload != NULL)
- i_stream_unref(&tcreq->payload);
- if (tcreq->file != NULL)
- i_stream_unref(&tcreq->file);
+ i_stream_unref(&tcreq->payload);
+ i_stream_unref(&tcreq->file);
DLLIST_REMOVE(&client_requests, tcreq);
i_free(tcreq);
static void test_server_disconnect(struct test_server *server)
{
- if (server->input != NULL)
- i_stream_unref(&server->input);
- if (server->output != NULL)
- o_stream_unref(&server->output);
+ i_stream_unref(&server->input);
+ o_stream_unref(&server->output);
i_close_fd(&server->fd);
}
*_mpurl = NULL;
- if (mpurl->result.input != NULL)
- i_stream_unref(&mpurl->result.input);
+ i_stream_unref(&mpurl->result.input);
if (mpurl->part != NULL)
imap_msgpart_free(&mpurl->part);
if (mpurl->mail != NULL)
i_free_and_null(ufetch->pending_reply.url);
i_free_and_null(ufetch->pending_reply.bodypartstruct);
i_free_and_null(ufetch->pending_reply.error);
- if (ufetch->pending_reply.input != NULL)
- i_stream_unref(&ufetch->pending_reply.input);
+ i_stream_unref(&ufetch->pending_reply.input);
url = ufetch->local_urls_head;
for (; url != NULL; url = url_next) {
mail_index_strmap_set_syscall_error(strmap, "close()");
strmap->fd = -1;
}
- if (strmap->input != NULL)
- i_stream_unref(&strmap->input);
+ i_stream_unref(&strmap->input);
}
void mail_index_strmap_deinit(struct mail_index_strmap **_strmap)
array_foreach(&conn->streams, streamp) {
stream = *streamp;
- if (stream != NULL)
- i_stream_unref(&stream);
+ i_stream_unref(&stream);
}
i_stream_unref(&conn->base_input);
pool_unref(&conn->pool);
efds = array_get_modifiable(&pclient->extra_fds, &count);
for(i = 0; i < count; i++) {
- if (efds[i].input != NULL)
- i_stream_unref(&efds[i].input);
+ i_stream_unref(&efds[i].input);
io_remove(&efds[i].io);
if (efds[i].parent_fd != -1 && close(efds[i].parent_fd) < 0)
i_error("close(fd=%d) failed: %m", efds[i].parent_fd);
void program_client_set_input(struct program_client *pclient,
struct istream *input)
{
- if (pclient->input != NULL)
- i_stream_unref(&pclient->input);
+ i_stream_unref(&pclient->input);
if (input != NULL)
i_stream_ref(input);
pclient->input = input;
void program_client_set_output(struct program_client *pclient,
struct ostream *output)
{
- if (pclient->output != NULL)
- o_stream_unref(&pclient->output);
+ o_stream_unref(&pclient->output);
if (output != NULL)
o_stream_ref(output);
pclient->output = output;
void program_client_set_output_seekable(struct program_client *pclient,
const char *temp_prefix)
{
- if (pclient->output != NULL)
- o_stream_unref(&pclient->output);
+ o_stream_unref(&pclient->output);
pclient->temp_prefix = i_strdup(temp_prefix);
pclient->output_seekable = TRUE;
}
i_assert(pclient->callback == NULL);
- if (pclient->input != NULL)
- i_stream_unref(&pclient->input);
- if (pclient->dot_input != NULL)
- i_stream_unref(&pclient->dot_input);
- if (pclient->program_input != NULL)
- i_stream_unref(&pclient->program_input);
- if (pclient->program_output != NULL)
- o_stream_unref(&pclient->program_output);
- if (pclient->output != NULL)
- o_stream_unref(&pclient->output);
- if (pclient->seekable_output != NULL)
- i_stream_unref(&pclient->seekable_output);
+ i_stream_unref(&pclient->input);
+ i_stream_unref(&pclient->dot_input);
+ i_stream_unref(&pclient->program_input);
+ o_stream_unref(&pclient->program_output);
+ o_stream_unref(&pclient->output);
+ i_stream_unref(&pclient->seekable_output);
io_remove(&pclient->io);
i_free(pclient->temp_prefix);
io_remove(&client->io);
o_stream_unref(&client->out);
i_stream_unref(&client->in);
- if (client->os_body != NULL)
- o_stream_unref(&client->os_body);
- if (client->body != NULL)
- i_stream_unref(&client->body);
+ o_stream_unref(&client->os_body);
+ i_stream_unref(&client->body);
close(client->fd);
pool_unref(&client->pool);
test_globals.client = NULL;
io_remove(&client->io);
o_stream_unref(&client->out);
i_stream_unref(&client->in);
- if (client->os_body != NULL)
- o_stream_unref(&client->os_body);
- if (client->body != NULL)
- i_stream_unref(&client->body);
+ o_stream_unref(&client->os_body);
+ i_stream_unref(&client->body);
i_close_fd(&client->fd);
pool_unref(&client->pool);
test_globals.client = NULL;
net_disconnect(client->fd);
client->fd = -1;
}
- if (client->data_input != NULL)
- i_stream_unref(&client->data_input);
+ i_stream_unref(&client->data_input);
client->output_finished = TRUE;
if (!client->finish_called) {
return;
i_assert(client->finish_called);
- if (client->input != NULL)
- i_stream_unref(&client->input);
- if (client->output != NULL)
- o_stream_unref(&client->output);
+ i_stream_unref(&client->input);
+ o_stream_unref(&client->output);
str_free(&client->input_multiline);
pool_unref(&client->pool);
}
{
struct _successful_delivery_server *ctx =
(struct _successful_delivery_server *)conn->context;
- if (ctx->dot_input != NULL)
- i_stream_unref(&ctx->dot_input);
- if (ctx->file != NULL)
- o_stream_unref(&ctx->file);
+ i_stream_unref(&ctx->dot_input);
+ o_stream_unref(&ctx->file);
}
static void test_server_successful_delivery(unsigned int index)
index_mail_cache_parse_deinit(_ctx->dest_mail,
_ctx->data.received_date, !ctx->failed);
- if (ctx->input != NULL)
- i_stream_unref(&ctx->input);
+ i_stream_unref(&ctx->input);
index_save_context_free(_ctx);
return ctx->failed ? -1 : 0;
dbox_file_set_corrupted(mail->open_file,
"uid=%u points to broken data at offset="
"%"PRIuUOFF_T, _mail->uid, offset);
- if (input != NULL)
- i_stream_unref(&input);
+ i_stream_unref(&input);
return -1;
}
data->stream = input;
if (arg->type == IMAP_ARG_LITERAL_SIZE) {
if (!imapc_find_lfile_arg(reply, arg, &fd)) {
- if (hdr_stream != NULL)
- i_stream_unref(&hdr_stream);
+ i_stream_unref(&hdr_stream);
return;
}
if ((fd = dup(fd)) == -1) {
i_error("dup() failed: %m");
- if (hdr_stream != NULL)
- i_stream_unref(&hdr_stream);
+ i_stream_unref(&hdr_stream);
return;
}
mail->fd = fd;
value = NULL;
if (value == NULL) {
mail_set_expunged(&imail->mail.mail);
- if (hdr_stream != NULL)
- i_stream_unref(&hdr_stream);
+ i_stream_unref(&hdr_stream);
return;
}
if (mail->body == NULL) {
ctx->failed = TRUE;
}
- if (_ctx->data.output != NULL)
- o_stream_unref(&_ctx->data.output);
- if (ctx->input != NULL)
- i_stream_unref(&ctx->input);
+ o_stream_unref(&_ctx->data.output);
+ i_stream_unref(&ctx->input);
if (ctx->fd != -1) {
if (close(ctx->fd) < 0)
i_error("close(%s) failed: %m", ctx->temp_path);
if (mail->data.save_bodystructure_body)
mail->data.save_bodystructure_header = TRUE;
}
- if (data->filter_stream != NULL)
- i_stream_unref(&data->filter_stream);
+ i_stream_unref(&data->filter_stream);
if (data->stream != NULL) {
struct istream *orig_stream = data->stream;
struct index_mailbox_context *ibox = INDEX_STORAGE_CONTEXT(box);
mailbox_watch_remove_all(box);
- if (box->input != NULL)
- i_stream_unref(&box->input);
+ i_stream_unref(&box->input);
if (box->view_pvt != NULL)
mail_index_view_close(&box->view_pvt);
/* wait for any prefetch to finish before closing the mail */
while (pmail->prefetching)
pop3c_client_wait_one(mbox->client);
- if (pmail->prefetch_stream != NULL)
- i_stream_unref(&pmail->prefetch_stream);
+ i_stream_unref(&pmail->prefetch_stream);
index_mail_close(_mail);
}
/* remove io from the ioloop before unreferencing the istream,
because a destroyed istream may automatically close the
fd. */
- if (istream != NULL)
- i_stream_unref(&istream);
+ i_stream_unref(&istream);
}
}
void iostream_rawlog_close(struct rawlog_iostream *rstream)
{
- if (rstream->rawlog_output != NULL)
- o_stream_unref(&rstream->rawlog_output);
+ o_stream_unref(&rstream->rawlog_output);
if (rstream->buffer != NULL)
buffer_free(&rstream->buffer);
}
while (link != NULL) {
struct istream_chain_link *next = link->next;
- if (link->stream != NULL)
- i_stream_unref(&link->stream);
+ i_stream_unref(&link->stream);
i_free(link);
link = next;
}
if (sstream->membuf != NULL)
buffer_free(&sstream->membuf);
- if (sstream->fd_input != NULL)
- i_stream_unref(&sstream->fd_input);
+ i_stream_unref(&sstream->fd_input);
unref_streams(sstream);
if (sstream->free_context)
str_free(&_stream->line_str);
}
if (!io_stream_unref(&(*stream)->real_stream->iostream)) {
- if ((*stream)->real_stream->parent != NULL)
- i_stream_unref(&(*stream)->real_stream->parent);
+ i_stream_unref(&(*stream)->real_stream->parent);
io_stream_free(&(*stream)->real_stream->iostream);
}
*stream = NULL;
struct istream_private *_stream = (struct istream_private *)stream;
i_free(_stream->w_buffer);
- if (_stream->parent != NULL)
- i_stream_unref(&_stream->parent);
+ i_stream_unref(&_stream->parent);
}
static void
{
struct ostream_private *_stream = (struct ostream_private *)stream;
- if (_stream->parent != NULL)
- o_stream_unref(&_stream->parent);
+ o_stream_unref(&_stream->parent);
}
static void
if (client->state.mail_data != NULL)
buffer_free(&client->state.mail_data);
- if (client->state.mail_data_output != NULL)
- o_stream_unref(&client->state.mail_data_output);
+ o_stream_unref(&client->state.mail_data_output);
if (client->state.mail_data_fd != -1) {
if (close(client->state.mail_data_fd) < 0)
i_error("close(mail data fd) failed: %m");
*_proxy = NULL;
lmtp_proxy_connections_deinit(proxy);
- if (proxy->data_input != NULL)
- i_stream_unref(&proxy->data_input);
- if (proxy->client_output != NULL)
- o_stream_unref(&proxy->client_output);
+ i_stream_unref(&proxy->data_input);
+ o_stream_unref(&proxy->client_output);
timeout_remove(&proxy->to_finish);
array_free(&proxy->rcpt_to);
array_free(&proxy->connections);
conn->finished = TRUE;
timeout_remove(&conn->to);
- if (conn->data_input != NULL)
- i_stream_unref(&conn->data_input);
+ i_stream_unref(&conn->data_input);
lmtp_proxy_try_finish(conn->proxy);
}
if (client->ssl_proxy != NULL)
ssl_proxy_free(&client->ssl_proxy);
- if (client->input != NULL)
- i_stream_unref(&client->input);
- if (client->output != NULL)
- o_stream_unref(&client->output);
+ i_stream_unref(&client->input);
+ o_stream_unref(&client->output);
i_free(client->proxy_user);
i_free(client->proxy_master_user);
{
struct compress_fs_file *file = (struct compress_fs_file *)_file;
- if (file->input != NULL)
- i_stream_unref(&file->input);
+ i_stream_unref(&file->input);
if (file->super_read != NULL)
fs_file_close(file->super_read);
if (_file->parent != NULL)
i_unlink_if_exists(ctx->log->path);
}
- if (ctx->input != NULL)
- i_stream_unref(&ctx->input);
+ i_stream_unref(&ctx->input);
i_free(ctx);
return ret;
}
/* remove io before unrefing payload - otherwise lib-http adds another
timeout to ioloop unnecessarily */
- if (parser->payload != NULL)
- i_stream_unref(&parser->payload);
+ i_stream_unref(&parser->payload);
io_remove(&parser->io);
if (parser->http_req != NULL)
http_client_request_abort(&parser->http_req);
{
struct crypt_fs_file *file = (struct crypt_fs_file *)_file;
- if (file->input != NULL)
- i_stream_unref(&file->input);
+ i_stream_unref(&file->input);
if (file->super_read != NULL)
fs_file_close(file->super_read);
if (_file->parent != NULL)
struct mail_crypt_cache *cache = &muser->cache;
timeout_remove(&cache->to);
- if (cache->input != NULL)
- i_stream_unref(&cache->input);
+ i_stream_unref(&cache->input);
i_zero(cache);
}
struct zlib_mail_cache *cache = &zuser->cache;
timeout_remove(&cache->to);
- if (cache->input != NULL)
- i_stream_unref(&cache->input);
+ i_stream_unref(&cache->input);
i_zero(cache);
}