diff --git a/compiler2/ttcn3/profiler.c b/compiler2/ttcn3/profiler.c index 273c415b357a2b2a366a8f887d35926f5343a6f2..6de701c4b9a1cf9092b30bc1a1b98919e001505f 100644 --- a/compiler2/ttcn3/profiler.c +++ b/compiler2/ttcn3/profiler.c @@ -23,7 +23,7 @@ static tcov_file_list *the_files = 0; static profiler_data_t *the_data = 0; /** The current database index for the next get_profiler_code_line() call */ -static int current_index = 0; +static size_t current_index = 0; /** The file parameter for the last get_profiler_code_line() call */ static char* last_file_name = 0; @@ -58,11 +58,10 @@ boolean is_file_profiled(const char* p_file_name) } void insert_profiler_code_line(const char* p_file_name, - const char* p_function_name, int p_line_no) + const char* p_function_name, size_t p_line_no) { /* check if the entry already exists */ - int i; - for (i = 0; i < the_data->nof_lines; ++i) { + for (size_t i = 0; i < the_data->nof_lines; ++i) { if (0 == strcmp(p_file_name,the_data->lines[i].file_name) && p_line_no == the_data->lines[i].line_no) { if (0 == the_data->lines[i].function_name && 0 != p_function_name) { @@ -113,8 +112,7 @@ boolean get_profiler_code_line(const char *p_file_name, void free_profiler_data() { - int i; - for (i = 0; i < the_data->nof_lines; ++i) { + for (size_t i = 0; i < the_data->nof_lines; ++i) { Free(the_data->lines[i].file_name); Free(the_data->lines[i].function_name); } diff --git a/compiler2/ttcn3/profiler.h b/compiler2/ttcn3/profiler.h index a20346480b5cd927395aca371a3c5fd4751159e5..65cd748003c771b36494ba58e1d79e78d05774cc 100644 --- a/compiler2/ttcn3/profiler.h +++ b/compiler2/ttcn3/profiler.h @@ -27,7 +27,7 @@ typedef struct profiler_code_line_t { /** Name of the function that starts at this line (or null if no function starts here) */ char* function_name; /** Code line number */ - int line_no; + size_t line_no; } profiler_code_line_t; /** Profiler database @@ -38,8 +38,8 @@ typedef struct profiler_code_line_t { * unused lines and functions. */ typedef struct profiler_data_t { profiler_code_line_t *lines; - int nof_lines; - int size; + size_t nof_lines; + size_t size; } profiler_data_t; /** Initializes the database (must be called once, at the start of compilation) */ @@ -55,7 +55,7 @@ boolean is_file_profiled(const char* p_file_name); * @param p_line_no [in] line number (for lines) or the function's starting line * (for functions) */ void insert_profiler_code_line(const char* p_file_name, - const char* p_function_name, int p_line_no); + const char* p_function_name, size_t p_line_no); /** Retrieves the next code line or function from the specified file. Calling this * function with the same file parameter will keep returning the next code line