Skip to content
Snippets Groups Projects
Commit eeec0231 authored by Kristof Szabados's avatar Kristof Szabados Committed by Gerrit Code Review
Browse files

Merge "it is not really possible to have negative amount of lines in a file"

parents a0f18ccb 53ae1392
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment