[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
awk: nuke flush_all() (was: awk: manpage correction)
- To: tech_(_at_)_openbsd_(_dot_)_org
- Subject: awk: nuke flush_all() (was: awk: manpage correction)
- From: Matthias Kilian <kili_(_at_)_outback_(_dot_)_escape_(_dot_)_de>
- Date: Wed, 29 Mar 2006 16:34:57 +0200
- Mail-followup-to: tech_(_at_)_openbsd_(_dot_)_org
On Wed, Mar 29, 2006 at 03:54:52PM +0200, Matthias Kilian wrote:
> [1] on awk's fflush(): in run.c, the function flush_all(void)
> obsolete; all calls to it could be replaced by fflush(NULL). I'll
> try to rip of a separate patch for this from my current patch chaos.
Here it is (actually, there's only one call to flush_all()). Any
comments?
Ciao,
Kili
diff -x CVS -rNu ../awk.orig/run.c ./run.c
--- ../awk.orig/run.c Fri Oct 21 21:21:03 2005
+++ ./run.c Wed Mar 29 16:06:18 2006
@@ -92,7 +92,6 @@
Node *curnode = NULL; /* the node being executed, for debugging */
void stdinit(void);
-void flush_all(void);
/* buffer memory management */
int adjbuf(char **pbuf, int *psiz, int minlen, int quantum, char **pbptr,
@@ -1545,7 +1544,7 @@
return x;
case FFLUSH:
if (isrec(x) || strlen(getsval(x)) == 0) {
- flush_all(); /* fflush() or fflush("") -> all */
+ fflush(NULL); /* fflush() or fflush("") -> all */
u = 0;
} else if ((fp = openfile(FFLUSH, getsval(x))) == NULL)
u = EOF;
@@ -1736,15 +1735,6 @@
WARNING( "i/o error occurred while closing %s", files[i].fname );
}
}
-}
-
-void flush_all(void)
-{
- int i;
-
- for (i = 0; i < FOPEN_MAX; i++)
- if (files[i].fp)
- fflush(files[i].fp);
}
void backsub(char **pb_ptr, char **sptr_ptr);
Visit your host, monkey.org