浏览代码

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