TOOLS/file2string: use array of tuples to avoid unpacking strings

This commit is contained in:
Kacper Michajłow committed 2025-01-25 02:35:54 +01:00
1 parent da2880fb54
commit 37b513a760
1 file changed
+1 -1
+1 -1
View File
@@ -35,7 +35,7 @@ def file2string(infilename, infile, outfile):
for c in safe_chars:
conv[ord(c)] = c
for c, esc in ("\nn", "\tt", r"\\", '""'):
for c, esc in [("\n", "n"), ("\t", "t"), ("\\", "\\"), ('"', '"')]:
conv[ord(c)] = "\\" + esc
for line in infile:
outfile.write('"' + "".join(conv[c] for c in line) + '"\n')