]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: remove redundant explicit deref in trace.go
authorIskander Sharipov <quasilyte@gmail.com>
Tue, 10 Jul 2018 05:32:56 +0000 (08:32 +0300)
committerBrad Fitzpatrick <bradfitz@golang.org>
Wed, 22 Aug 2018 19:48:50 +0000 (19:48 +0000)
Replaces legacy Go syntax for pointer struct member access
with more modern auto-deref alternative.

Found using https://go-critic.github.io/overview#underef-ref

Change-Id: I71a3c424126c4ff5d89f9e4bacb6cc01c6fa2ddf
Reviewed-on: https://go-review.googlesource.com/122895
Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/runtime/trace.go

index 22d8d026dc67c0947323809acf56add4371bcb08..08e92d2efe6b94f504fff01d43cb6f6a5e0a1711 100644 (file)
@@ -532,12 +532,12 @@ func traceEvent(ev byte, skip int, args ...uint64) {
 }
 
 func traceEventLocked(extraBytes int, mp *m, pid int32, bufp *traceBufPtr, ev byte, skip int, args ...uint64) {
-       buf := (*bufp).ptr()
+       buf := bufp.ptr()
        // TODO: test on non-zero extraBytes param.
        maxSize := 2 + 5*traceBytesPerNumber + extraBytes // event type, length, sequence, timestamp, stack id and two add params
        if buf == nil || len(buf.arr)-buf.pos < maxSize {
                buf = traceFlush(traceBufPtrOf(buf), pid).ptr()
-               (*bufp).set(buf)
+               bufp.set(buf)
        }
 
        ticks := uint64(cputicks()) / traceTickDiv
@@ -689,11 +689,11 @@ func traceString(bufp *traceBufPtr, pid int32, s string) (uint64, *traceBufPtr)
        // so there must be no memory allocation or any activities
        // that causes tracing after this point.
 
-       buf := (*bufp).ptr()
+       buf := bufp.ptr()
        size := 1 + 2*traceBytesPerNumber + len(s)
        if buf == nil || len(buf.arr)-buf.pos < size {
                buf = traceFlush(traceBufPtrOf(buf), pid).ptr()
-               (*bufp).set(buf)
+               bufp.set(buf)
        }
        buf.byte(traceEvString)
        buf.varint(id)
@@ -708,7 +708,7 @@ func traceString(bufp *traceBufPtr, pid int32, s string) (uint64, *traceBufPtr)
        buf.varint(uint64(slen))
        buf.pos += copy(buf.arr[buf.pos:], s[:slen])
 
-       (*bufp).set(buf)
+       bufp.set(buf)
        return id, bufp
 }
 
@@ -1206,7 +1206,7 @@ func trace_userLog(id uint64, category, message string) {
        traceEventLocked(extraSpace, mp, pid, bufp, traceEvUserLog, 3, id, categoryID)
        // traceEventLocked reserved extra space for val and len(val)
        // in buf, so buf now has room for the following.
-       buf := (*bufp).ptr()
+       buf := bufp.ptr()
 
        // double-check the message and its length can fit.
        // Otherwise, truncate the message.