summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Reinhardt <steve.reinhardt@amd.com>2009-09-26 10:50:50 -0700
committerSteve Reinhardt <steve.reinhardt@amd.com>2009-09-26 10:50:50 -0700
commit7a8ee4f40a4fbbbbf4d6a8e5b6a81d0486b1a1b6 (patch)
tree651e58e40f45756e65065f271f68b052ca7d75e3
parent4bec4702e9338735f58f0769f853ddff3657850e (diff)
downloadgem5-7a8ee4f40a4fbbbbf4d6a8e5b6a81d0486b1a1b6.tar.xz
rundiff: Don't flush stdout until after postcontext is printed.
-rwxr-xr-xutil/rundiff10
1 files changed, 8 insertions, 2 deletions
diff --git a/util/rundiff b/util/rundiff
index cd2527e54..7e0a77057 100755
--- a/util/rundiff
+++ b/util/rundiff
@@ -166,7 +166,11 @@ sub printdiff
# Set $postcontext to print the next $postcontext_lines matching lines.
$postcontext = $postcontext_lines;
- STDOUT->flush();
+ # Normally we flush after the postcontext lines are printed, but if
+ # the user has decreed that there aren't any we need to flush now
+ if ($postcontext == 0) {
+ STDOUT->flush();
+ }
}
@@ -291,10 +295,12 @@ while (1) {
# figure out what to do with this line
if ($postcontext > 0) {
# we're in the post-context of a diff: print it
- $postcontext--;
print ' ', $l1;
$lineno1++;
$lineno2++;
+ if (--$postcontext == 0) {
+ STDOUT->flush();
+ }
}
else {
# we're in the middle of a matching region... save this