mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 16:57:46 +00:00
Test: Mark compilation-unit-only functions as static
This enables a nice warning in case a function becomes dead code. Also, in the case of test-crypto.cpp, I took the liberty to add the prefix 'g_' to the global event loop.
This commit is contained in:
parent
2b76f48a17
commit
76da9a4a7d
9 changed files with 191 additions and 192 deletions
|
@ -42,7 +42,7 @@ struct worker_t {
|
|||
long int wait_time;
|
||||
};
|
||||
|
||||
void* run_worker(void* args)
|
||||
static void* run_worker(void* args)
|
||||
{
|
||||
struct timespec time_to_wait = { 0, 0 };
|
||||
worker_t* worker = (worker_t*)args;
|
||||
|
@ -65,7 +65,7 @@ void* run_worker(void* args)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void init_worker(worker_t* worker, const char* name, long int wait_time)
|
||||
static void init_worker(worker_t* worker, const char* name, long int wait_time)
|
||||
{
|
||||
worker->name = name;
|
||||
worker->wait_time = wait_time;
|
||||
|
|
|
@ -256,7 +256,7 @@ constexpr size_t NUM_TESTCASES = sizeof(TESTCASES) / sizeof(TESTCASES[0]);
|
|||
|
||||
typedef double (*strtod_fn_t)(const char* str, char** endptr);
|
||||
|
||||
long long cast_ll(double d)
|
||||
static long long cast_ll(double d)
|
||||
{
|
||||
union readable_t {
|
||||
double as_double;
|
||||
|
@ -273,7 +273,7 @@ long long cast_ll(double d)
|
|||
return readable.as_ll;
|
||||
}
|
||||
|
||||
bool is_strtod_close(strtod_fn_t strtod_fn, const char* test_string, const char* expect_hex, int expect_consume, long long expect_ll)
|
||||
static bool is_strtod_close(strtod_fn_t strtod_fn, const char* test_string, const char* expect_hex, int expect_consume, long long expect_ll)
|
||||
{
|
||||
union readable_t {
|
||||
double as_double;
|
||||
|
@ -324,7 +324,7 @@ bool is_strtod_close(strtod_fn_t strtod_fn, const char* test_string, const char*
|
|||
return !(wrong_hex || error_cns || wrong_cns);
|
||||
}
|
||||
|
||||
long long hex_to_ll(const char* hex)
|
||||
static long long hex_to_ll(const char* hex)
|
||||
{
|
||||
long long result = 0;
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
|
|
|
@ -37,7 +37,7 @@ struct SortableObject {
|
|||
int m_payload;
|
||||
};
|
||||
|
||||
int compare_sortable_object(const void* a, const void* b)
|
||||
static int compare_sortable_object(const void* a, const void* b)
|
||||
{
|
||||
const int key1 = static_cast<const SortableObject*>(a)->m_key;
|
||||
const int key2 = static_cast<const SortableObject*>(b)->m_key;
|
||||
|
@ -50,13 +50,13 @@ int compare_sortable_object(const void* a, const void* b)
|
|||
}
|
||||
}
|
||||
|
||||
int calc_payload_for_pos(size_t pos)
|
||||
static int calc_payload_for_pos(size_t pos)
|
||||
{
|
||||
pos *= 231;
|
||||
return pos ^ (pos << 8) ^ (pos << 16) ^ (pos << 24);
|
||||
}
|
||||
|
||||
void shuffle_vec(Vector<SortableObject>& test_objects)
|
||||
static void shuffle_vec(Vector<SortableObject>& test_objects)
|
||||
{
|
||||
for (size_t i = 0; i < test_objects.size() * 3; ++i) {
|
||||
auto i1 = rand() % test_objects.size();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue