Explorar el Código

Remove the buffer copying, no longer necessary

Xiuming Chen hace 12 años
padre
commit
745998a315
Se han modificado 1 ficheros con 1 adiciones y 5 borrados
  1. 1 5
      packets.go

+ 1 - 5
packets.go

@@ -61,11 +61,7 @@ func (mc *mysqlConn) readPacket() ([]byte, error) {
 			return nil, driver.ErrBadConn
 		}
 
-		// Make a copy since data becomes invalid with the next read
-		buf := make([]byte, len(data))
-		copy(buf, data)
-
-		payload = append(payload, buf...)
+		payload = append(payload, data...)
 
 		if pktLen < maxPacketSize {
 			return payload, nil