mirror of
				https://github.com/go-delve/delve.git
				synced 2025-10-31 18:57:18 +08:00 
			
		
		
		
	pkg/proc: simplify code with trivial changes (#3436)
This commit is contained in:
		| @ -100,10 +100,10 @@ func threadsFromDelveNotes(p *process, notes []*note) (proc.Thread, error) { | |||||||
| 				readerr = fmt.Errorf("maximum len exceeded (%d) reading %s", len, kind) | 				readerr = fmt.Errorf("maximum len exceeded (%d) reading %s", len, kind) | ||||||
| 				return nil | 				return nil | ||||||
| 			} | 			} | ||||||
| 			buf := make([]byte, len) |  | ||||||
| 			if readerr != nil { | 			if readerr != nil { | ||||||
| 				return nil | 				return nil | ||||||
| 			} | 			} | ||||||
|  | 			buf := make([]byte, len) | ||||||
| 			_, readerr = body.Read(buf) | 			_, readerr = body.Read(buf) | ||||||
| 			return buf | 			return buf | ||||||
| 		} | 		} | ||||||
|  | |||||||
| @ -1286,7 +1286,7 @@ func (conn *gdbConn) exec(cmd []byte, context string) ([]byte, error) { | |||||||
| 	return conn.recv(cmd, context, false) | 	return conn.recv(cmd, context, false) | ||||||
| } | } | ||||||
|  |  | ||||||
| var hexdigit = []byte{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'} | const hexdigit = "0123456789abcdef" | ||||||
|  |  | ||||||
| func (conn *gdbConn) send(cmd []byte) error { | func (conn *gdbConn) send(cmd []byte) error { | ||||||
| 	if len(cmd) == 0 || cmd[0] != '$' { | 	if len(cmd) == 0 || cmd[0] != '$' { | ||||||
| @ -1344,10 +1344,12 @@ func (conn *gdbConn) recv(cmd []byte, context string, binary bool) (resp []byte, | |||||||
| 		if logflags.GdbWire() { | 		if logflags.GdbWire() { | ||||||
| 			out := resp | 			out := resp | ||||||
| 			partial := false | 			partial := false | ||||||
| 			if idx := bytes.Index(out, []byte{'\n'}); idx >= 0 && !binary { | 			if !binary { | ||||||
|  | 				if idx := bytes.Index(out, []byte{'\n'}); idx >= 0 { | ||||||
| 					out = resp[:idx] | 					out = resp[:idx] | ||||||
| 					partial = true | 					partial = true | ||||||
| 				} | 				} | ||||||
|  | 			} | ||||||
| 			if len(out) > gdbWireMaxLen { | 			if len(out) > gdbWireMaxLen { | ||||||
| 				out = out[:gdbWireMaxLen] | 				out = out[:gdbWireMaxLen] | ||||||
| 				partial = true | 				partial = true | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 gocurr
					gocurr