Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix redundant cast-to-int when INI_USE_STACK!=0 (#137)
Code context (ini.c): 101: #if INI_USE_STACK 102: char line[INI_MAX_LINE]; 103: int max_line = INI_MAX_LINE; 104: #else 105: char* line; 106: size_t max_line = INI_INITIAL_ALLOC; 107: #endif ... 133: while (reader(line, (int)max_line, stream) != NULL) { SonarCloud is reporting a "code smell" due to a redundant cast to `int` at line 133. This only happens when INI_USE_STACK is true, and not otherwise, as in that case, `max_line` is of type `size_t` that gets correctly casted to `int`. This patch changes the type of `max_line` variable to `size_t` for all situations. SonarCloud report URL: https://sonarcloud.io/project/issues?pullRequest=221&issues=AYGYdhPZKkhmUWy1nsvP&open=AYGYdhPZKkhmUWy1nsvP&id=snoopy Co-authored-by: Ben Hoyt <[email protected]>
- Loading branch information