* lib/csharpcomp.c: Include <stddef.h>.
(compile_csharp_using_dotnet): Read bytes into a buffer, not one-by-one.
+2025-02-25 Bruno Haible <bruno@clisp.org>
+
+ csharpcomp: Reduce number of read() system calls.
+ * lib/csharpcomp.c: Include <stddef.h>.
+ (compile_csharp_using_dotnet): Read bytes into a buffer, not one-by-one.
+
2025-02-25 Bruno Haible <bruno@clisp.org>
vc-mtime: Reduce number of read() system calls.
#include <dirent.h>
#include <errno.h>
+#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
{
/* Read the subprocess output, and test whether it is
non-empty. */
- size_t count = 0;
- char c;
+ ptrdiff_t count = 0;
- while (safe_read (fd[0], &c, 1) > 0)
- count++;
+ for (;;)
+ {
+ char buf[1024];
+ ptrdiff_t n = safe_read (fd[0], buf, sizeof (buf));
+ if (n > 0)
+ count += n;
+ else
+ break;
+ }
close (fd[0]);