log_message() format parameter should be const char* #53

Closed
opened 2026-07-20 17:14:08 +02:00 by TapTap · 0 comments
Owner

Description

In src/shared/log.h line 6 and src/shared/log.c line 13, the log_message() function signature uses char* format instead of const char* format:

void log_message(LogLevel log_level, char* message, ...);

This prevents passing string literals without a cast and generates warnings with -Wwrite-strings or -Wpedantic. The format string is not modified by the function.

Location

src/shared/log.h:6, src/shared/log.c:13

Suggested Fix

Change the signature to const char* format (and const char* message):

void log_message(LogLevel log_level, const char* message, ...);

Severity

Low

Category

Quality

## Description In `src/shared/log.h` line 6 and `src/shared/log.c` line 13, the `log_message()` function signature uses `char* format` instead of `const char* format`: ```c void log_message(LogLevel log_level, char* message, ...); ``` This prevents passing string literals without a cast and generates warnings with `-Wwrite-strings` or `-Wpedantic`. The format string is not modified by the function. ## Location `src/shared/log.h:6`, `src/shared/log.c:13` ## Suggested Fix Change the signature to `const char* format` (and `const char* message`): ```c void log_message(LogLevel log_level, const char* message, ...); ``` ## Severity Low ## Category Quality
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: TapTap/FastSync#53