Commit e3d028fb authored by Martin Storsjö's avatar Martin Storsjö
Browse files

Use size_t as return value type for strlen() consistently

parent 95233f9e
...@@ -127,7 +127,7 @@ static struct { ...@@ -127,7 +127,7 @@ static struct {
CheckasmFuncVersion *current_func_ver; CheckasmFuncVersion *current_func_ver;
const char *current_test_name; const char *current_test_name;
const char *bench_pattern; const char *bench_pattern;
int bench_pattern_len; size_t bench_pattern_len;
int num_checked; int num_checked;
int num_failed; int num_failed;
int nop_time; int nop_time;
...@@ -420,7 +420,7 @@ static CheckasmFunc *get_func(CheckasmFunc **root, const char *const name) { ...@@ -420,7 +420,7 @@ static CheckasmFunc *get_func(CheckasmFunc **root, const char *const name) {
} }
} else { } else {
/* Allocate and insert a new node into the tree */ /* Allocate and insert a new node into the tree */
const int name_length = strlen(name); const size_t name_length = strlen(name);
f = *root = checkasm_malloc(sizeof(CheckasmFunc) + name_length); f = *root = checkasm_malloc(sizeof(CheckasmFunc) + name_length);
memcpy(f->name, name, name_length + 1); memcpy(f->name, name, name_length + 1);
} }
...@@ -636,10 +636,11 @@ void checkasm_update_bench(const int iterations, const uint64_t cycles) { ...@@ -636,10 +636,11 @@ void checkasm_update_bench(const int iterations, const uint64_t cycles) {
/* Print the outcome of all tests performed since /* Print the outcome of all tests performed since
* the last time this function was called */ * the last time this function was called */
void checkasm_report(const char *const name, ...) { void checkasm_report(const char *const name, ...) {
static int prev_checked, prev_failed, max_length; static int prev_checked, prev_failed;
static size_t max_length;
if (state.num_checked > prev_checked) { if (state.num_checked > prev_checked) {
int pad_length = max_length + 4; int pad_length = (int) max_length + 4;
va_list arg; va_list arg;
print_cpu_name(); print_cpu_name();
...@@ -660,7 +661,7 @@ void checkasm_report(const char *const name, ...) { ...@@ -660,7 +661,7 @@ void checkasm_report(const char *const name, ...) {
} else if (!state.cpu_flag) { } else if (!state.cpu_flag) {
/* Calculate the amount of padding required /* Calculate the amount of padding required
* to make the output vertically aligned */ * to make the output vertically aligned */
int length = strlen(state.current_test_name); size_t length = strlen(state.current_test_name);
va_list arg; va_list arg;
va_start(arg, name); va_start(arg, name);
......
...@@ -57,7 +57,7 @@ void init_demuxers(void) { ...@@ -57,7 +57,7 @@ void init_demuxers(void) {
} }
static const char *find_extension(const char *const f) { static const char *find_extension(const char *const f) {
const int l = strlen(f); const size_t l = strlen(f);
if (l == 0) return NULL; if (l == 0) return NULL;
......
...@@ -59,7 +59,7 @@ void init_muxers(void) { ...@@ -59,7 +59,7 @@ void init_muxers(void) {
} }
static const char *find_extension(const char *const f) { static const char *find_extension(const char *const f) {
const int l = strlen(f); const size_t l = strlen(f);
if (l == 0) return NULL; if (l == 0) return NULL;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment