0
0
mirror of https://git.openwrt.org/openwrt/openwrt.git synced 2025-08-05 06:00:26 +00:00
Files
openwrt/tools/gnulib/patches/796-vc-mtime-less-read.patch
Michael Pratt 1a253a2bb5 tools/gnulib: backport patches for gettext
The latest versions of gettext rely on several changes to gnulib
including both changes to modules and new modules
and some previously gettext specific code being moved to gnulib.

Backport these changes in order to allow updating gettext
while using the local gnulib copy of sources.

Add patch:
 - 640-mem-hash-map.patch
 - 645-next-prime.patch
 - 646-hashcode-string.patch
 - 647-hashkey-string.patch
 - 650-package-version.patch
 - 651-package-version-simplify.patch
 - 652-package-version-simplify-further.patch
 - 653-package-version-warning.patch
 - 660-version-stamp.patch
 - 689-vc-mtime.patch
 - 755-clean-temp-hashkey.patch
 - 795-string-desc-rename-functions.patch
 - 796-vc-mtime-less-read.patch
 - 797-vc-mtime-add-api.patch
 - 798-vc-mtime-add-api.patch
 - 799-vc-mtime-old-git.patch
 - 900-str_startswith-module.patch
 - 901-str_endswith-module.patch

Signed-off-by: Michael Pratt <mcpratt@pm.me>
Link: https://github.com/openwrt/openwrt/pull/16522
Signed-off-by: Robert Marko <robimarko@gmail.com>
2025-07-26 14:38:09 +02:00

45 lines
1.0 KiB
Diff

From 60cd34886c2c9f509974239fcf64a61f9a507d14 Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@clisp.org>
Date: Tue, 25 Feb 2025 09:04:28 +0100
Subject: [PATCH] vc-mtime: Reduce number of read() system calls.
* lib/vc-mtime.c: Include <stddef.h>.
(git_vc_controlled): Read bytes into a buffer, not one-by-one.
---
ChangeLog | 6 ++++++
lib/vc-mtime.c | 15 +++++++++++----
2 files changed, 17 insertions(+), 4 deletions(-)
--- a/lib/vc-mtime.c
+++ b/lib/vc-mtime.c
@@ -21,6 +21,7 @@
/* Specification. */
#include "vc-mtime.h"
+#include <stddef.h>
#include <stdlib.h>
#include <unistd.h>
@@ -56,11 +57,17 @@ git_vc_controlled (const char *filename)
return false;
/* 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]);