1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

log: avoid using string__plus memory leak (#11128)

This commit is contained in:
wilesun
2021-08-11 14:26:02 +08:00
committed by GitHub
parent 70124d2d23
commit 18be9e52be
3 changed files with 24 additions and 5 deletions

View File

@ -117,7 +117,7 @@ pub fn (t Time) get_fmt_date_str(fmt_dlmtr FormatDelimiter, fmt_date FormatDate)
if fmt_date == .no_date {
return ''
}
month := '$t.smonth()'
month := t.smonth()
year := '${(t.year % 100):02d}'
mut res := match fmt_date {
.ddmmyy { '${t.day:02d}|${t.month:02d}|$year' }
@ -156,7 +156,9 @@ pub fn (t Time) get_fmt_str(fmt_dlmtr FormatDelimiter, fmt_time FormatTime, fmt_
}
} else {
if fmt_time != .no_time {
return t.get_fmt_date_str(fmt_dlmtr, fmt_date) + ' ' + t.get_fmt_time_str(fmt_time)
dstr := t.get_fmt_date_str(fmt_dlmtr, fmt_date)
tstr := t.get_fmt_time_str(fmt_time)
return '$dstr $tstr'
} else {
return t.get_fmt_date_str(fmt_dlmtr, fmt_date)
}