Make eligible functions static

The codebase is already very disciplined in making any function which
can be `static`, but there are a few that appear to have slipped through
the cracks.
This commit is contained in:
Kevin Svetlitski 2023-05-08 12:37:18 -07:00 committed by Qi Wang
parent 6841110bd6
commit 70344a2d38
9 changed files with 16 additions and 14 deletions

View File

@ -44,8 +44,6 @@ void extent_destroy_wrapper(tsdn_t *tsdn, pac_t *pac, ehooks_t *ehooks,
edata_t *edata);
bool extent_commit_wrapper(tsdn_t *tsdn, ehooks_t *ehooks, edata_t *edata,
size_t offset, size_t length);
bool extent_decommit_wrapper(tsdn_t *tsdn, ehooks_t *ehooks, edata_t *edata,
size_t offset, size_t length);
bool extent_purge_lazy_wrapper(tsdn_t *tsdn, ehooks_t *ehooks, edata_t *edata,
size_t offset, size_t length);
bool extent_purge_forced_wrapper(tsdn_t *tsdn, ehooks_t *ehooks, edata_t *edata,

View File

@ -14,7 +14,7 @@ static const uint64_t h_steps[SMOOTHSTEP_NSTEPS] = {
* Generate a new deadline that is uniformly random within the next epoch after
* the current one.
*/
void
static void
decay_deadline_init(decay_t *decay) {
nstime_copy(&decay->deadline, &decay->epoch);
nstime_add(&decay->deadline, &decay->interval);

View File

@ -43,6 +43,8 @@ static edata_t *extent_try_coalesce(tsdn_t *tsdn, pac_t *pac, ehooks_t *ehooks,
static edata_t *extent_alloc_retained(tsdn_t *tsdn, pac_t *pac,
ehooks_t *ehooks, edata_t *expand_edata, size_t size, size_t alignment,
bool zero, bool *commit, bool guarded);
static bool extent_decommit_wrapper(tsdn_t *tsdn, ehooks_t *ehooks,
edata_t *edata, size_t offset, size_t length);
/******************************************************************************/
@ -1118,7 +1120,7 @@ extent_commit_wrapper(tsdn_t *tsdn, ehooks_t *ehooks, edata_t *edata,
/* growing_retained */ false);
}
bool
static bool
extent_decommit_wrapper(tsdn_t *tsdn, ehooks_t *ehooks, edata_t *edata,
size_t offset, size_t length) {
witness_assert_depth_to_rank(tsdn_witness_tsdp_get(tsdn),

View File

@ -83,7 +83,7 @@ hpa_alloc_ps(tsdn_t *tsdn, hpa_central_t *central) {
CACHELINE);
}
hpdata_t *
static hpdata_t *
hpa_central_extract(tsdn_t *tsdn, hpa_central_t *central, size_t size,
bool *oom) {
/* Don't yet support big allocations; these should get filtered out. */

View File

@ -48,7 +48,7 @@ TEST_BEGIN(test_pow2_ceil_zu) {
}
TEST_END
void
static void
expect_lg_ceil_range(size_t input, unsigned answer) {
if (input == 1) {
expect_u_eq(0, answer, "Got %u as lg_ceil of 1", answer);
@ -60,7 +60,7 @@ expect_lg_ceil_range(size_t input, unsigned answer) {
"Got %u as lg_ceil of %zu", answer, input);
}
void
static void
expect_lg_floor_range(size_t input, unsigned answer) {
if (input == 1) {
expect_u_eq(0, answer, "Got %u as lg_floor of 1", answer);

View File

@ -9,19 +9,20 @@ void fake_abort(const char *message) {
fake_abort_called = true;
}
void
static void
test_double_free_pre(void) {
safety_check_set_abort(&fake_abort);
fake_abort_called = false;
}
void
static void
test_double_free_post() {
expect_b_eq(fake_abort_called, true, "Double-free check didn't fire.");
safety_check_set_abort(NULL);
}
bool tcache_enabled() {
static bool
tcache_enabled() {
bool enabled;
size_t sz = sizeof(enabled);
assert_d_eq(

View File

@ -201,7 +201,7 @@ TEST_BEGIN(test_nstime_divide) {
}
TEST_END
void
static void
test_nstime_since_once(nstime_t *t) {
nstime_t old_t;
nstime_copy(&old_t, t);

View File

@ -48,7 +48,8 @@ struct test_data_s {
extent_hooks_t hooks;
};
test_data_t *init_test_data(ssize_t dirty_decay_ms, ssize_t muzzy_decay_ms) {
static test_data_t *
init_test_data(ssize_t dirty_decay_ms, ssize_t muzzy_decay_ms) {
test_data_t *test_data = calloc(1, sizeof(test_data_t));
assert_ptr_not_null(test_data, "");
init_test_extent_hooks(&test_data->hooks);

View File

@ -14,7 +14,7 @@ void fake_abort(const char *message) {
#define LARGE_SIZE1 SC_LARGE_MINCLASS
#define LARGE_SIZE2 (LARGE_SIZE1 * 2)
void *
static void *
test_invalid_size_pre(size_t sz) {
safety_check_set_abort(&fake_abort);
@ -25,7 +25,7 @@ test_invalid_size_pre(size_t sz) {
return ptr;
}
void
static void
test_invalid_size_post(void) {
expect_true(fake_abort_called, "Safety check didn't fire");
safety_check_set_abort(NULL);