diff options
author | Aliaksandr Valialkin <valyala@gmail.com> | 2016-03-29 16:37:29 +0300 |
---|---|---|
committer | Aliaksandr Valialkin <valyala@gmail.com> | 2016-03-29 16:37:29 +0300 |
commit | 6658e31fd04ebf014057c60e200fdc47a1dc7b4d (patch) | |
tree | fb9a8755d2e708d53d8c490123a39c79cf9e97a7 /args.go | |
parent | Pass string key to hasArg instead of byte slice key (diff) | |
download | fasthttp-6658e31fd04ebf014057c60e200fdc47a1dc7b4d.tar.gz fasthttp-6658e31fd04ebf014057c60e200fdc47a1dc7b4d.tar.bz2 fasthttp-6658e31fd04ebf014057c60e200fdc47a1dc7b4d.zip |
Eliminated bufKV member from Args struct. This shaves off 16 bytes from RequestCtx struct
Diffstat (limited to 'args.go')
-rw-r--r-- | args.go | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -38,9 +38,8 @@ var argsPool = &sync.Pool{ type Args struct { noCopy noCopy - args []argsKV - bufKV argsKV - buf []byte + args []argsKV + buf []byte } type argsKV struct { @@ -216,14 +215,15 @@ func (a *Args) GetUint(key string) (int, error) { // SetUint sets uint value for the given key. func (a *Args) SetUint(key string, value int) { - a.bufKV.key = append(a.bufKV.key[:0], key...) - a.SetUintBytes(a.bufKV.key, value) + bb := AcquireByteBuffer() + bb.B = AppendUint(bb.B[:0], value) + a.SetBytesV(key, bb.B) + ReleaseByteBuffer(bb) } // SetUintBytes sets uint value for the given key. func (a *Args) SetUintBytes(key []byte, value int) { - a.bufKV.value = AppendUint(a.bufKV.value[:0], value) - a.SetBytesKV(key, a.bufKV.value) + a.SetUint(b2s(key), value) } // GetUintOrZero returns uint value for the given key. |