فهرست منبع

Remove the buffer copying, no longer necessary

Xiuming Chen 12 سال پیش
والد
کامیت
745998a315
1فایلهای تغییر یافته به همراه1 افزوده شده و 5 حذف شده
  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