diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2023-02-23 19:54:44 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2023-02-23 19:54:44 +0200 |
commit | 1c16328521f317b4f3df3d3010fc17e9811bd5e1 (patch) | |
tree | ab42a19be4446a1dc8d24d50a992bb1ac507b39b | |
parent | 2480186827f4e5f9b4269426742d5f4985dcbe01 (diff) | |
download | gawk-1c16328521f317b4f3df3d3010fc17e9811bd5e1.tar.gz |
Code improvement: RED_NOBUF -> RED_FLUSH.
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | awk.h | 2 | ||||
-rw-r--r-- | builtin.c | 2 | ||||
-rw-r--r-- | io.c | 12 |
4 files changed, 15 insertions, 8 deletions
@@ -4,6 +4,13 @@ already being handled by an input parser. Found by code inspection. + Unrelated: + + * awk.h (struct redirect): Change RED_NOBUF to RED_FLUSH. + * builtin.c (efwrite): Ditto + * io.c (redflags2str, check_duplicated_redirections, + redirect_string): Ditto. + 2023-02-09 Arnold D. Robbins <arnold@skeeve.com> * main.c (usage): Include URL for source code in the message. @@ -972,7 +972,7 @@ struct redirect { RED_READ = 4, RED_WRITE = 8, RED_APPEND = 16, - RED_NOBUF = 32, + RED_FLUSH = 32, RED_USED = 64, /* closed temporarily to reuse fd */ RED_EOF = 128, RED_TWOWAY = 256, @@ -192,7 +192,7 @@ efwrite(const void *ptr, } if (flush && ((fp == stdout && output_is_tty) - || (rp != NULL && (rp->flag & RED_NOBUF) != 0))) + || (rp != NULL && (rp->flag & RED_FLUSH) != 0))) efflush(fp, from, rp); } @@ -693,7 +693,7 @@ redflags2str(int flags) { RED_READ, "RED_READ" }, { RED_WRITE, "RED_WRITE" }, { RED_APPEND, "RED_APPEND" }, - { RED_NOBUF, "RED_NOBUF" }, + { RED_FLUSH, "RED_FLUSH" }, { RED_EOF, "RED_EOF" }, { RED_TWOWAY, "RED_TWOWAY" }, { RED_PTY, "RED_PTY" }, @@ -745,8 +745,8 @@ check_duplicated_redirections(const char *name, size_t len, }; int i = 0, j = sizeof(mixtures) / sizeof(mixtures[0]); - oldflags &= ~(RED_NOBUF|RED_EOF|RED_PTY); - newflags &= ~(RED_NOBUF|RED_EOF|RED_PTY); + oldflags &= ~(RED_FLUSH|RED_EOF|RED_PTY); + newflags &= ~(RED_FLUSH|RED_EOF|RED_PTY); for (i = 0; i < j; i++) { bool both_have_common = \ @@ -877,7 +877,7 @@ redirect_string(const char *str, size_t explen, bool not_string, (redirect_flags_t) rp->flag, (redirect_flags_t) tflag); } - if (((rp->flag & ~(RED_NOBUF|RED_EOF|RED_PTY)) == tflag + if (((rp->flag & ~(RED_FLUSH|RED_EOF|RED_PTY)) == tflag || (outflag != 0 && (rp->flag & (RED_FILE|RED_WRITE)) == outflag))) { break; @@ -951,7 +951,7 @@ redirect_string(const char *str, size_t explen, bool not_string, /* set close-on-exec */ os_close_on_exec(fileno(rp->output.fp), str, "pipe", "to"); - rp->flag |= RED_NOBUF; + rp->flag |= RED_FLUSH; break; case redirect_pipein: if (extfd >= 0) { @@ -1032,7 +1032,7 @@ redirect_string(const char *str, size_t explen, bool not_string, close(fd); } if (rp->output.fp != NULL && os_isatty(fd)) - rp->flag |= RED_NOBUF; + rp->flag |= RED_FLUSH; /* Move rp to the head of the list. */ if (! new_rp && red_head != rp) { |