Skip to content

Commit a94257c

Browse files
committed
Make naming of types more specific to avoid future collisions
1 parent 7439bb7 commit a94257c

File tree

7 files changed

+11
-11
lines changed

7 files changed

+11
-11
lines changed

Sources/GDBRemoteProtocol/CommandDecoder.swift renamed to Sources/GDBRemoteProtocol/GDBHostCommandDecoder.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ package struct GDBHostCommandDecoder: ByteToMessageDecoder {
2020
case checksumIncorrect
2121
}
2222

23-
package typealias InboundOut = Packet<GDBHostCommand>
23+
package typealias InboundOut = GDBPacket<GDBHostCommand>
2424

2525
private var accummulatedKind = [UInt8]()
2626
private var accummulatedArguments = [UInt8]()
@@ -32,7 +32,7 @@ package struct GDBHostCommandDecoder: ByteToMessageDecoder {
3232
UInt8(self.accummulatedSum % 256)
3333
}
3434

35-
mutating package func decode(buffer: inout ByteBuffer) throws -> Packet<GDBHostCommand>? {
35+
mutating package func decode(buffer: inout ByteBuffer) throws -> GDBPacket<GDBHostCommand>? {
3636
// Command start delimiters.
3737
let firstStartDelimiter = buffer.readInteger(as: UInt8.self)
3838
let secondStartDelimiter = buffer.readInteger(as: UInt8.self)

Sources/GDBRemoteProtocol/Package.swift renamed to Sources/GDBRemoteProtocol/GDBPacket.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package struct Packet<Payload> {
1+
package struct GDBPacket<Payload> {
22
package let payload: Payload
33

44
package let checksum: UInt8
@@ -9,4 +9,4 @@ package struct Packet<Payload> {
99
}
1010
}
1111

12-
extension Packet: Equatable where Payload: Equatable {}
12+
extension GDBPacket: Equatable where Payload: Equatable {}

Sources/GDBRemoteProtocol/TargetResponse.swift renamed to Sources/GDBRemoteProtocol/GDBTargetResponse.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ package enum VContActions: String {
88
case stepInRange = "r"
99
}
1010

11-
package struct TargetResponse {
11+
package struct GDBTargetResponse {
1212
package enum Kind {
1313
case ok
1414
case hostInfo(KeyValuePairs<String, String>)

Sources/GDBRemoteProtocol/ResponseEncoder.swift renamed to Sources/GDBRemoteProtocol/GDBTargetResponseEncoder.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ extension String {
99

1010
package struct GDBTargetResponseEncoder: MessageToByteEncoder {
1111
package init() {}
12-
package func encode(data: TargetResponse, out: inout ByteBuffer) throws {
12+
package func encode(data: GDBTargetResponse, out: inout ByteBuffer) throws {
1313
if !data.isNoAckModeActive {
1414
out.writeInteger(UInt8(ascii: "+"))
1515
}

Sources/WasmKitGDBHandler/WasmKitHandler.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import WasmKit
55
import struct Foundation.Date
66

77
package final class WasmKitHandler: ChannelInboundHandler {
8-
package typealias InboundIn = Packet<GDBHostCommand>
9-
package typealias OutboundOut = TargetResponse
8+
package typealias InboundIn = GDBPacket<GDBHostCommand>
9+
package typealias OutboundOut = GDBTargetResponse
1010

1111
/// Whether `QStartNoAckMode` command was previously sent.
1212
private var isNoAckModeActive = false
@@ -18,7 +18,7 @@ package final class WasmKitHandler: ChannelInboundHandler {
1818
data: NIOAny
1919
) {
2020
let command = self.unwrapInboundIn(data).payload
21-
let responseKind: TargetResponse.Kind
21+
let responseKind: GDBTargetResponse.Kind
2222
print(command.kind)
2323

2424
switch command.kind {

Tests/GDBRemoteProtocolTests/RemoteProtocolTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ struct LLDBRemoteProtocolTests {
1010

1111
var buffer = ByteBuffer(string: "+$g#67")
1212
var packet = try decoder.decode(buffer: &buffer)
13-
#expect(packet == Packet(payload: GDBHostCommand(kind: .generalRegisters, arguments: ""), checksum: 103))
13+
#expect(packet == GDBPacket(payload: GDBHostCommand(kind: .generalRegisters, arguments: ""), checksum: 103))
1414
#expect(decoder.accummulatedChecksum == 0)
1515

1616
buffer = ByteBuffer(
@@ -20,7 +20,7 @@ struct LLDBRemoteProtocolTests {
2020
)
2121

2222
packet = try decoder.decode(buffer: &buffer)
23-
let expectedPacket = Packet(
23+
let expectedPacket = GDBPacket(
2424
payload: GDBHostCommand(
2525
kind: .supportedFeatures,
2626
arguments: "xmlRegisters=i386,arm,mips,arc;multiprocess+;fork-events+;vfork-events+"

0 commit comments

Comments
 (0)