Skip to content

Commit b704c61

Browse files
committed
indicate that the regexes are read only
Signed-off-by: Benedek Kupper <[email protected]>
1 parent eab741d commit b704c61

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

Dfu/Device.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ private Status SeErase(uint address)
565565
return status;
566566
}
567567

568-
private static Regex SeMemoryLayoutRegex = new Regex(
568+
private static readonly Regex SeMemoryLayoutRegex = new Regex(
569569
@"^@(?<name>[\w\s]*[\w]+)\s*
570570
/0x(?<address>[A-F0-9]{1,8})
571571
/(\d+)\*(\d+)([\x20KM]{1})([a-g]{1})(?:,(\d+)\*(\d+)([\x20KM]{1})([a-g]{1}))*$",

FileFormat/IntelHex.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ private enum RecordType : byte
122122

123123
private static readonly int CountCharOffset = 11;
124124

125-
private static Regex RecordRegex = new Regex
125+
private static readonly Regex RecordRegex = new Regex
126126
(@"^:(?<bytecount>[A-F0-9]{2})(?<address>[A-F0-9]{4})(?<recordtype>0[0-5]{1})(?<data>(?:[A-F0-9]{2})*)(?<checksum>[A-F0-9]{2})$",
127127
RegexOptions.Compiled | RegexOptions.IgnorePatternWhitespace);
128128
}

FileFormat/SRecord.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ private enum RecordType : byte
9696

9797
private static readonly int CountCharOffset = 4;
9898

99-
private static Regex RecordRegex = new Regex
99+
private static readonly Regex RecordRegex = new Regex
100100
(@"^S(?:(?:(?<recordtype>[0,1,5,9]{1})(?<bytecount>[A-F0-9]{2})(?<address>(?:[A-F0-9]{2}){2})) |
101101
(?:(?<recordtype>[2,6,8]{1})(?<bytecount>[A-F0-9]{2})(?<address>(?:[A-F0-9]{2}){3})) |
102102
(?:(?<recordtype>[3,7]{1})(?<bytecount>[A-F0-9]{2})(?<address>(?:[A-F0-9]{2}){4})))(?<data>(?:[A-F0-9]{2})*)(?<checksum>[A-F0-9]{2})$",

0 commit comments

Comments
 (0)