Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/native/minipal/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,10 @@ static size_t log_write_line(minipal_log_flags flags, const char* msg, size_t ms

int minipal_log_write(minipal_log_flags flags, const char* msg)
{
assert(msg != NULL && msg[0] != '\0');
assert(msg != NULL);

if (msg[0] == '\0')
Copy link

Copilot AI May 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The empty-string check logic is duplicated in both log write functions. Consider extracting this into a common helper to reduce duplication and ease maintenance.

Suggested change
if (msg[0] == '\0')
if (is_empty_string(msg))

Copilot uses AI. Check for mistakes.
return 0;

size_t msg_len = strlen(msg);
const char* msg_end = msg + msg_len;
Expand Down Expand Up @@ -302,7 +305,10 @@ typedef ssize_t (*write_file_fnptr)(minipal_log_flags flags, const char* msg, si

int minipal_log_write(minipal_log_flags flags, const char* msg)
{
assert(msg != NULL && msg[0] != '\0');
assert(msg != NULL);

if (msg[0] == '\0')
return 0;

size_t bytes_to_write = 0;
size_t bytes_written = 0;
Expand Down