Skip to content

Commit 0155fe9

Browse files
committed
Assert two always-true conditions
1 parent 8b31eec commit 0155fe9

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

loguru.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -1247,7 +1247,8 @@ namespace loguru
12471247
if (out_buff_size == 0) { return; }
12481248
out_buff[0] = '\0';
12491249
size_t pos = 0;
1250-
if (g_preamble_date && pos < out_buff_size) {
1250+
assert(pos < out_buff_size);
1251+
if (g_preamble_date) {
12511252
int bytes = snprintf(out_buff + pos, out_buff_size - pos, "date ");
12521253
if (bytes > 0) {
12531254
pos += bytes;
@@ -1324,8 +1325,8 @@ namespace loguru
13241325
}
13251326

13261327
size_t pos = 0;
1327-
1328-
if (g_preamble_date && pos < out_buff_size) {
1328+
assert(pos < out_buff_size);
1329+
if (g_preamble_date) {
13291330
int bytes = snprintf(out_buff + pos, out_buff_size - pos, "%04d-%02d-%02d ",
13301331
1900 + time_info.tm_year, 1 + time_info.tm_mon, time_info.tm_mday);
13311332
if (bytes > 0) {

0 commit comments

Comments
 (0)