Skip to content

Commit

Permalink
Added asserts to make static analyzer happier.
Browse files Browse the repository at this point in the history
  • Loading branch information
sirainen authored and GitLab committed Sep 13, 2016
1 parent 3177b41 commit abb4045
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/lib-fs/fs-posix.c
Expand Up @@ -495,6 +495,7 @@ static int fs_posix_write(struct fs_file *_file, const void *data, size_t size)
if (file->fd == -1) {
if (fs_posix_open(file) < 0)
return -1;
i_assert(file->fd != -1);
}

if (file->open_mode != FS_OPEN_MODE_APPEND) {
Expand Down
1 change: 1 addition & 0 deletions src/lib-index/mailbox-log.c
Expand Up @@ -176,6 +176,7 @@ int mailbox_log_append(struct mailbox_log *log,
if (log->fd == -1) {
if (mailbox_log_open(log) < 0)
return -1;
i_assert(log->fd != -1);
}

/* We don't bother with locking, atomic appends will protect us.
Expand Down
1 change: 1 addition & 0 deletions src/lib-stats/stats-connection.c
Expand Up @@ -83,6 +83,7 @@ int stats_connection_send(struct stats_connection *conn, const string_t *str)
if (conn->fd == -1) {
if (!stats_connection_open(conn))
return -1;
i_assert(conn->fd != -1);
}

if (str_len(str) > PIPE_BUF && !pipe_warned) {
Expand Down
1 change: 1 addition & 0 deletions src/lib-storage/index/imapc/imapc-mail.c
Expand Up @@ -187,6 +187,7 @@ static int imapc_mail_get_physical_size(struct mail *_mail, uoff_t *size_r)
old_offset = data->stream == NULL ? 0 : data->stream->v_offset;
if (mail_get_stream(_mail, NULL, NULL, &input) < 0)
return -1;
i_assert(data->stream != NULL);
i_stream_seek(data->stream, old_offset);

ret = i_stream_get_size(data->stream, TRUE,
Expand Down
1 change: 1 addition & 0 deletions src/lib/istream-file.c
Expand Up @@ -54,6 +54,7 @@ ssize_t i_stream_file_read(struct istream_private *stream)
if (stream->fd == -1) {
if (i_stream_file_open(stream) < 0)
return -1;
i_assert(stream->fd != -1);
}

offset = stream->istream.v_offset + (stream->pos - stream->skip);
Expand Down
1 change: 1 addition & 0 deletions src/login-common/login-proxy-state.c
Expand Up @@ -138,6 +138,7 @@ static bool login_proxy_state_try_notify(struct login_proxy_state *state,
if (state->notify_fd == -1) {
if (login_proxy_state_notify_open(state) < 0)
return TRUE;
i_assert(state->notify_fd != -1);
}

T_BEGIN {
Expand Down
1 change: 1 addition & 0 deletions src/plugins/fts/fts-api.c
Expand Up @@ -125,6 +125,7 @@ static void fts_backend_set_cur_mailbox(struct fts_backend_update_context *ctx)
{
fts_backend_update_unset_build_key(ctx);
if (ctx->backend_box != ctx->cur_box) {
i_assert(ctx->cur_box != NULL);
ctx->backend->v.update_set_mailbox(ctx, ctx->cur_box);
ctx->backend_box = ctx->cur_box;
}
Expand Down
1 change: 1 addition & 0 deletions src/plugins/virtual/virtual-mail.c
Expand Up @@ -131,6 +131,7 @@ static int backend_mail_get(struct virtual_mail *vmail,
return -1;
}
(void)virtual_mail_set_backend_mail(mail, bbox);
i_assert(vmail->cur_backend_mail != NULL);
}
virtual_backend_box_accessed(mbox, bbox);
vmail->cur_lost = !mail_set_uid(vmail->cur_backend_mail,
Expand Down

0 comments on commit abb4045

Please sign in to comment.