From 2386c9c80d1d38f44f23c134c748810a9f1add0a Mon Sep 17 00:00:00 2001 From: jianzhiyao Date: Sun, 26 Jul 2020 22:37:42 +0800 Subject: [PATCH] delete useless if-stmt --- context/input.go | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/context/input.go b/context/input.go index da066a86..fb01648f 100644 --- a/context/input.go +++ b/context/input.go @@ -323,28 +323,20 @@ func (input *BeegoInput) SetParam(key, val string) { // This function is used to clear parameters so they may be reset between filter // passes. func (input *BeegoInput) ResetParams() { - if len(input.pnames) > 0 { - input.pnames = input.pnames[:0] - } - if len(input.pvalues) > 0 { - input.pvalues = input.pvalues[:0] - } + input.pnames = input.pnames[:0] + input.pvalues = input.pvalues[:0] } // ResetData: reset data func (input *BeegoInput) ResetData() { input.dataLock.Lock() - if input.data != nil { - input.data = nil - } + input.data = nil input.dataLock.Unlock() } // ResetBody: reset body func (input *BeegoInput) ResetBody() { - if len(input.RequestBody) > 0 { - input.RequestBody = []byte{} - } + input.RequestBody = []byte{} } // Clear: clear all data in input