From: "Martin Storsjö via ffmpeg-devel" <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: "Martin Storsjö" <code@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH] tools: Make indent_arm_assembly.pl able to reformat a file in place (PR #20980)
Date: Thu, 20 Nov 2025 12:42:10 -0000
Message-ID: <176364253129.59.12416521069424438422@2cb04c0e5124> (raw)
PR #20980 opened by Martin Storsjö (mstorsjo)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20980
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20980.patch
This allows using the tool for one-off reindentations without needing
the check_arm_indent.sh script (e.g. for use outside of ffmpeg),
without having to pipe the file through stdin/stdout.
From 053aec1915fbe5ea506beb254b29cc9f4480560b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Tue, 18 Nov 2025 12:13:37 +0200
Subject: [PATCH] tools: Make indent_arm_assembly.pl able to reformat a file in
place
This allows using the tool for one-off reindentations without needing
the check_arm_indent.sh script (e.g. for use outside of ffmpeg),
without having to pipe the file through stdin/stdout.
---
tools/indent_arm_assembly.pl | 31 ++++++++++++++++++++++++++++---
1 file changed, 28 insertions(+), 3 deletions(-)
diff --git a/tools/indent_arm_assembly.pl b/tools/indent_arm_assembly.pl
index 7d5d1ecef2..77d6d6fdf3 100755
--- a/tools/indent_arm_assembly.pl
+++ b/tools/indent_arm_assembly.pl
@@ -41,6 +41,7 @@ my $indent_operands = 0;
my $instr_indent = 8;
my $operand_indent = 24;
my $match_indent = 0;
+my $file;
while (@ARGV) {
my $opt = shift;
@@ -54,7 +55,11 @@ while (@ARGV) {
} elsif ($opt eq "-match-indent") {
$match_indent = 1;
} else {
- die "Unrecognized parameter $opt\n";
+ if (!$file) {
+ $file = $opt;
+ } else {
+ die "Unrecognized parameter $opt\n";
+ }
}
}
@@ -130,7 +135,22 @@ sub columns {
return indentcolumns($rest, 3);
}
-while (<STDIN>) {
+my $in;
+my $out;
+my $tempfile;
+
+if ($file) {
+ open(INPUT, "$file") or die "Unable to open $file: $!";
+ $in = *INPUT;
+ $tempfile = "$file.tmp";
+ open(OUTPUT, ">$tempfile") or die "Unable to open $tempfile: $!";
+ $out = *OUTPUT;
+} else {
+ $in = *STDIN;
+ $out = *STDOUT;
+}
+
+while (<$in>) {
# Trim off trailing whitespace.
chomp;
if (/^([\.\w\d]+:)?(\s+)([\w\\][\w\\\.]*)(?:(\s+)(.*)|$)/) {
@@ -201,5 +221,10 @@ while (<STDIN>) {
$_ = $label . $indent . $instr . $operand_space . $rest;
}
}
- print $_ . "\n";
+ print $out $_ . "\n";
+}
+
+if ($file) {
+ close(OUTPUT);
+ rename($tempfile, $file);
}
--
2.49.1
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
reply other threads:[~2025-11-20 12:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=176364253129.59.12416521069424438422@2cb04c0e5124 \
--to=ffmpeg-devel@ffmpeg.org \
--cc=code@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git