Skip to content

Commit

Permalink
WT-2031 Lint: Make functions void if they don't return any error.
Browse files Browse the repository at this point in the history
  • Loading branch information
sueloverso committed Aug 27, 2015
1 parent 66757f7 commit 5225b7b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 21 deletions.
4 changes: 2 additions & 2 deletions src/conn/conn_log.c
Expand Up @@ -494,7 +494,7 @@ __wt_log_wrlsn(WT_SESSION_IMPL *session)
&slot->slot_release_lsn) == 0 &&
__wt_log_cmp(&slot->slot_start_lsn,
&slot->slot_end_lsn) == 0) {
WT_ERR(__wt_log_slot_free(session, slot));
__wt_log_slot_free(session, slot);
continue;
}
if (coalescing != NULL) {
Expand Down Expand Up @@ -560,7 +560,7 @@ __wt_log_wrlsn(WT_SESSION_IMPL *session)
WT_ERR(__wt_cond_signal(
session, conn->log_file_cond));
}
WT_ERR(__wt_log_slot_free(session, slot));
__wt_log_slot_free(session, slot);
}
}
err: __wt_spin_unlock(session, &log->log_writelsn_lock);
Expand Down
6 changes: 3 additions & 3 deletions src/include/extern.h
Expand Up @@ -357,14 +357,14 @@ extern int __wt_logop_row_truncate_unpack( WT_SESSION_IMPL *session, const uint8
extern int __wt_logop_row_truncate_print( WT_SESSION_IMPL *session, const uint8_t **pp, const uint8_t *end, FILE *out);
extern int __wt_txn_op_printlog( WT_SESSION_IMPL *session, const uint8_t **pp, const uint8_t *end, FILE *out);
extern void __wt_log_slot_activate(WT_SESSION_IMPL *session, WT_LOGSLOT *slot);
extern int __wt_log_slot_close(WT_SESSION_IMPL *session, WT_LOGSLOT *slot, int *releasep);
extern void __wt_log_slot_close(WT_SESSION_IMPL *session, WT_LOGSLOT *slot, int *releasep);
extern int __wt_log_slot_switch(WT_SESSION_IMPL *session, WT_LOGSLOT *slot);
extern int __wt_log_slot_new(WT_SESSION_IMPL *session);
extern int __wt_log_slot_init(WT_SESSION_IMPL *session);
extern int __wt_log_slot_destroy(WT_SESSION_IMPL *session);
extern int __wt_log_slot_join(WT_SESSION_IMPL *session, uint64_t mysize, uint32_t flags, WT_MYSLOT *myslotp);
extern void __wt_log_slot_join(WT_SESSION_IMPL *session, uint64_t mysize, uint32_t flags, WT_MYSLOT *myslotp);
extern int64_t __wt_log_slot_release(WT_MYSLOT *myslot, int64_t size);
extern int __wt_log_slot_free(WT_SESSION_IMPL *session, WT_LOGSLOT *slot);
extern void __wt_log_slot_free(WT_SESSION_IMPL *session, WT_LOGSLOT *slot);
extern int __wt_clsm_request_switch(WT_CURSOR_LSM *clsm);
extern int __wt_clsm_await_switch(WT_CURSOR_LSM *clsm);
extern int __wt_clsm_init_merge( WT_CURSOR *cursor, u_int start_chunk, uint32_t start_id, u_int nchunks);
Expand Down
8 changes: 4 additions & 4 deletions src/log/log.c
Expand Up @@ -1632,11 +1632,11 @@ __log_force_write_internal(WT_SESSION_IMPL *session, int new_slot)
log = S2C(session)->log;
slot = log->active_slot;
WT_ASSERT(session, F_ISSET(session, WT_SESSION_LOCKED_SLOT));
WT_RET(__wt_log_slot_close(session, slot, &release));
__wt_log_slot_close(session, slot, &release);
if (release) {
WT_RET(__log_release(session, slot, &free_slot));
if (free_slot)
WT_RET(__wt_log_slot_free(session, slot));
__wt_log_slot_free(session, slot);
}
if (new_slot)
WT_RET(__wt_log_slot_new(session));
Expand Down Expand Up @@ -1963,7 +1963,7 @@ __log_write_internal(WT_SESSION_IMPL *session, WT_ITEM *record, WT_LSN *lsnp,
*/
WT_ERR(__wt_readlock(session, log->log_direct_lock));
locked = WT_READ_LOCKED;
WT_ERR(__wt_log_slot_join(session, rdup_len, flags, &myslot));
__wt_log_slot_join(session, rdup_len, flags, &myslot);
/*
* If the addition of this record crosses the buffer boundary,
* switch in a new slot.
Expand All @@ -1987,7 +1987,7 @@ __log_write_internal(WT_SESSION_IMPL *session, WT_ITEM *record, WT_LSN *lsnp,
if (WT_LOG_SLOT_DONE(release_size)) {
WT_ERR(__log_release(session, myslot.slot, &free_slot));
if (free_slot)
WT_ERR(__wt_log_slot_free(session, myslot.slot));
__wt_log_slot_free(session, myslot.slot);
} else if (force) {
/*
* If we are going to wait for this slot to get written,
Expand Down
20 changes: 8 additions & 12 deletions src/log/log_slot.c
Expand Up @@ -28,15 +28,14 @@ __wt_log_slot_activate(WT_SESSION_IMPL *session, WT_LOGSLOT *slot)
slot->slot_fh = log->log_fh;
slot->slot_error = 0;
slot->slot_unbuffered = 0;
return;
}

/*
* __wt_log_slot_close --
* Close out the slot the caller is using. The slot may already be
* closed or freed by another thread.
*/
int
void
__wt_log_slot_close(WT_SESSION_IMPL *session, WT_LOGSLOT *slot, int *releasep)
{
WT_CONNECTION_IMPL *conn;
Expand All @@ -49,20 +48,20 @@ __wt_log_slot_close(WT_SESSION_IMPL *session, WT_LOGSLOT *slot, int *releasep)
if (releasep != NULL)
*releasep = 0;
if (slot == NULL)
return (0);
return;
retry:
old_state = slot->slot_state;
/*
* If someone else is switching out this slot we lost. Nothing to
* do but return.
*/
if (WT_LOG_SLOT_CLOSED(old_state))
return (0);
return;
/*
* If someone completely processed this slot, we're done.
*/
if (FLD64_ISSET((uint64_t)slot->slot_state, WT_LOG_SLOT_RESERVED))
return (0);
return;
new_state = (old_state | WT_LOG_SLOT_CLOSE);
/*
* Close this slot. If we lose the race retry.
Expand All @@ -86,7 +85,6 @@ __wt_log_slot_close(WT_SESSION_IMPL *session, WT_LOGSLOT *slot, int *releasep)
*/
log->alloc_lsn = slot->slot_end_lsn;
WT_ASSERT(session, log->alloc_lsn.file >= log->write_lsn.file);
return (0);
}

/*
Expand All @@ -111,7 +109,7 @@ __wt_log_slot_switch(WT_SESSION_IMPL *session, WT_LOGSLOT *slot)
*/
if (slot != log->active_slot)
return (0);
WT_RET(__wt_log_slot_close(session, slot, &dummy));
__wt_log_slot_close(session, slot, &dummy);
/*
* Only mainline callers use switch. Our size should be in join
* and we have not yet released, so we should never think release
Expand Down Expand Up @@ -299,7 +297,7 @@ __wt_log_slot_destroy(WT_SESSION_IMPL *session)
* Join a consolidated logging slot. Must be called with
* the read lock held.
*/
int
void
__wt_log_slot_join(WT_SESSION_IMPL *session, uint64_t mysize,
uint32_t flags, WT_MYSLOT *myslotp)
{
Expand Down Expand Up @@ -329,7 +327,7 @@ __wt_log_slot_join(WT_SESSION_IMPL *session, uint64_t mysize,
*/
if (log->active_slot == NULL) {
WT_ASSERT(session, mysize == 0);
return (0);
return;
}
/*
* There should almost always be a slot open.
Expand Down Expand Up @@ -379,7 +377,6 @@ __wt_log_slot_join(WT_SESSION_IMPL *session, uint64_t mysize,
myslotp->slot = slot;
myslotp->offset = join_offset;
myslotp->end_offset = (wt_off_t)((uint64_t)join_offset + mysize);
return (0);
}

/*
Expand Down Expand Up @@ -420,7 +417,7 @@ __wt_log_slot_release(WT_MYSLOT *myslot, int64_t size)
* __wt_log_slot_free --
* Free a slot back into the pool.
*/
int
void
__wt_log_slot_free(WT_SESSION_IMPL *session, WT_LOGSLOT *slot)
{

Expand All @@ -433,5 +430,4 @@ __wt_log_slot_free(WT_SESSION_IMPL *session, WT_LOGSLOT *slot)
slot->flags = WT_SLOT_INIT_FLAGS;
slot->slot_error = 0;
slot->slot_state = WT_LOG_SLOT_FREE;
return (0);
}

0 comments on commit 5225b7b

Please sign in to comment.