Displaying 3 results from an estimated 3 matches for "fwrite_noflush".
2016 Feb 01
0
[klibc:master] fwrite: flush before a large write to allow better bypass
...zytor.com>
---
usr/klibc/stdio/fwrite.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/usr/klibc/stdio/fwrite.c b/usr/klibc/stdio/fwrite.c
index 71ee75c..feb48ef 100644
--- a/usr/klibc/stdio/fwrite.c
+++ b/usr/klibc/stdio/fwrite.c
@@ -14,14 +14,15 @@ static size_t fwrite_noflush(const void *buf, size_t count,
ssize_t rv;
while (count) {
- if (f->ibytes || f->obytes >= f->bufsiz)
+ if (f->ibytes || f->obytes >= f->bufsiz ||
+ (f->obytes && count >= f->bufsiz))
if (__fflush(f))
break;
- if (f->obytes == 0 &...
2016 Feb 01
0
[klibc:master] fwrite: fix typo in comment
...<hpa at zytor.com>
---
usr/klibc/stdio/fwrite.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/usr/klibc/stdio/fwrite.c b/usr/klibc/stdio/fwrite.c
index feb48ef..9f32ae4 100644
--- a/usr/klibc/stdio/fwrite.c
+++ b/usr/klibc/stdio/fwrite.c
@@ -21,7 +21,7 @@ static size_t fwrite_noflush(const void *buf, size_t count,
if (count >= f->bufsiz) {
/*
- * The the write is large, so bypass
+ * The write is large, so bypass
* buffering entirely.
*/
rv = write(f->pub._IO_fileno, p, count);
2014 Apr 09
0
[klibc:master] fwrite: use memrchr() to find the final ' \n' in _IOLBF mode
...hr(p, '\n', count);
+ pf_len = q ? q - p + 1 : 0;
break;
case _IONBF:
default:
pf_len = count;
- pu_len = 0;
break;
}
@@ -94,6 +88,7 @@ size_t _fwrite(const void *buf, size_t count, FILE *file)
return bytes;
}
+ pu_len = count - pf_len;
if (pu_len)
bytes += fwrite_noflush(p, pu_len, f);