Skip to content

Commit

Permalink
Assert two always-true conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
kcgen committed Sep 16, 2021
1 parent 8b31eec commit 0155fe9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions loguru.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1247,7 +1247,8 @@ namespace loguru
if (out_buff_size == 0) { return; }
out_buff[0] = '\0';
size_t pos = 0;
if (g_preamble_date && pos < out_buff_size) {
assert(pos < out_buff_size);
if (g_preamble_date) {
int bytes = snprintf(out_buff + pos, out_buff_size - pos, "date ");
if (bytes > 0) {
pos += bytes;
Expand Down Expand Up @@ -1324,8 +1325,8 @@ namespace loguru
}

size_t pos = 0;

if (g_preamble_date && pos < out_buff_size) {
assert(pos < out_buff_size);
if (g_preamble_date) {
int bytes = snprintf(out_buff + pos, out_buff_size - pos, "%04d-%02d-%02d ",
1900 + time_info.tm_year, 1 + time_info.tm_mon, time_info.tm_mday);
if (bytes > 0) {
Expand Down

0 comments on commit 0155fe9

Please sign in to comment.