diff options
author | XANTRONIX Development | 2023-09-11 13:50:24 -0400 |
---|---|---|
committer | XANTRONIX Development | 2023-09-11 13:50:24 -0400 |
commit | 1186261b3be58cdad08d265ef5652e10a69b8140 (patch) | |
tree | 868be65ca593bbe684a75b673b6c6c82e2e06043 | |
parent | ac55efa5df45f5c58e970b4becdf13465dd11b28 (diff) | |
download | zxdump-1186261b3be58cdad08d265ef5652e10a69b8140.tar.gz zxdump-1186261b3be58cdad08d265ef5652e10a69b8140.tar.bz2 zxdump-1186261b3be58cdad08d265ef5652e10a69b8140.zip |
Call isatty() way less frequently
-rw-r--r-- | main.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -139,6 +139,7 @@ error_io: static ssize_t dump_fd(int fd) { void *buf; ssize_t total = 0; + int tty = isatty(fileno(stdout)); struct stat st; if (fstat(fd, &st) < 0) { @@ -163,7 +164,7 @@ static ssize_t dump_fd(int fd) { size_t left = len - i, linesz = left < ZXDUMP_STRIDE_LINE? left: ZXDUMP_STRIDE_LINE; - if (dump_line(offset, buf, linesz, isatty(fileno(stdout))) < 0) { + if (dump_line(offset, buf, linesz, tty) < 0) { goto error_dump_line; } |