logging: avoid identifier collisions

MISRA-C Rule 5.3 states that identifiers in inner scope should
not hide identifiers in outer scope.

The log output instances all named "log_output" in backends
collide with the "log_output" parameter of various functions.
This renames the variables in the backends to make them
more descriptive. Same goes for the buffers for some of
these instances as they are all named "buf", and "hostname"
being used in the network backend,  so they are renamed.

There are a few places where variables are overriden within
an inner scope (e.g. inside loop and if block) so they are
also renamed.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
Daniel Leung 2020-07-23 14:39:34 -07:00 committed by Anas Nashif
commit 3c2d0f37a3
10 changed files with 65 additions and 59 deletions

View file

@ -229,9 +229,9 @@ static void color_print(const struct log_output *log_output,
bool color, bool start, uint32_t level)
{
if (color) {
const char *color = start && (colors[level] != NULL) ?
const char *log_color = start && (colors[level] != NULL) ?
colors[level] : LOG_COLOR_CODE_DEFAULT;
print_formatted(log_output, "%s", color);
print_formatted(log_output, "%s", log_color);
}
}