Skip to content

Commit b9a973c

Browse files
committed
codeformat: Do search&replace without sed
1 parent d3bf1fe commit b9a973c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tools/codeformat.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ def fixup_c(filename):
9999
# Get next line.
100100
l = lines.pop(0)
101101

102+
# Revert "// |" back to "//| "
103+
if l.startswith("// |"):
104+
l = "//|" + l[4:]
105+
102106
# Dedent #'s to match indent of following line (not previous line).
103107
m = re.match(r"( +)#(if |ifdef |ifndef |elif |else|endif)", l)
104108
if m:
@@ -167,8 +171,6 @@ def batch(cmd, files, N=200):
167171
batch(command, lang_files(C_EXTS))
168172
for file in lang_files(C_EXTS):
169173
fixup_c(file)
170-
# Revert "// |" back to "//|"
171-
batch(["sed", "-i", "s,^// |,//|,"], lang_files(C_EXTS))
172174

173175
# Format Python files with black.
174176
if format_py:

0 commit comments

Comments
 (0)