remove release() pattern

This commit is contained in:
Darien Raymond committed 2017-01-04 12:52:24 +01:00
1 parent 49210d8362
commit e678000c44
33 files changed
+17 -232

No files matched your search

-14
View File
@@ -4,12 +4,10 @@ import (
"fmt"
"strings"
"v2ray.com/core/common"
"v2ray.com/core/common/serial"
)
type LogEntry interface {
common.Releasable
fmt.Stringer
}
@@ -18,12 +16,6 @@ type ErrorLog struct {
Values []interface{}
}
func (v *ErrorLog) Release() {
for _, val := range v.Values {
common.Release(val)
}
}
func (v *ErrorLog) String() string {
return v.Prefix + serial.Concat(v.Values...)
}
@@ -35,12 +27,6 @@ type AccessLog struct {
Reason interface{}
}
func (v *AccessLog) Release() {
common.Release(v.From)
common.Release(v.To)
common.Release(v.Reason)
}
func (v *AccessLog) String() string {
return strings.Join([]string{serial.ToString(v.From), v.Status, serial.ToString(v.To), serial.ToString(v.Reason)}, " ")
}
+1 -5
View File
@@ -17,9 +17,7 @@ type LogWriter interface {
type NoOpLogWriter struct {
}
func (v *NoOpLogWriter) Log(entry LogEntry) {
entry.Release()
}
func (v *NoOpLogWriter) Log(entry LogEntry) {}
func (v *NoOpLogWriter) Close() {
}
@@ -38,7 +36,6 @@ func NewStdOutLogWriter() LogWriter {
func (v *StdOutLogWriter) Log(log LogEntry) {
v.logger.Print(log.String() + platform.LineSeparator())
log.Release()
}
func (v *StdOutLogWriter) Close() {
@@ -58,7 +55,6 @@ func (v *FileLogWriter) Log(log LogEntry) {
default:
// We don't expect this to happen, but don't want to block main thread as well.
}
log.Release()
}
func (v *FileLogWriter) run() {