summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2011-09-17 05:21:57 +0000
committerMike Frysinger <vapier@gentoo.org>2011-09-17 05:21:57 +0000
commit397bf25b55c015a119d2279b8ac18926e3f39e36 (patch)
tree654731ebb194567c58f1ccb0c10cde2c0587d5f2 /sys-devel/make/files
parentAdd fix from upstream for posix regex behavior #382919 by Christian Kaps. (diff)
downloadgentoo-2-397bf25b55c015a119d2279b8ac18926e3f39e36.tar.gz
gentoo-2-397bf25b55c015a119d2279b8ac18926e3f39e36.tar.bz2
gentoo-2-397bf25b55c015a119d2279b8ac18926e3f39e36.zip
Add glob optimization patch from upstream #382845 by Tomáš Chvátal.
(Portage version: 2.2.0_alpha58/cvs/Linux x86_64)
Diffstat (limited to 'sys-devel/make/files')
-rw-r--r--sys-devel/make/files/make-3.82-glob-speedup.patch89
1 files changed, 89 insertions, 0 deletions
diff --git a/sys-devel/make/files/make-3.82-glob-speedup.patch b/sys-devel/make/files/make-3.82-glob-speedup.patch
new file mode 100644
index 000000000000..79ca87eb60f5
--- /dev/null
+++ b/sys-devel/make/files/make-3.82-glob-speedup.patch
@@ -0,0 +1,89 @@
+change from upstream to speed up by skipping unused globs
+
+https://bugs.gentoo.org/382845
+
+--- a/read.c 2011/04/29 15:27:39 1.198
++++ b/read.c 2011/05/02 00:18:06 1.199
+@@ -2901,6 +2901,7 @@
+ const char *name;
+ const char **nlist = 0;
+ char *tildep = 0;
++ int globme = 1;
+ #ifndef NO_ARCHIVES
+ char *arname = 0;
+ char *memname = 0;
+@@ -3109,32 +3110,40 @@
+ }
+ #endif /* !NO_ARCHIVES */
+
+- switch (glob (name, GLOB_NOSORT|GLOB_ALTDIRFUNC, NULL, &gl))
+- {
+- case GLOB_NOSPACE:
+- fatal (NILF, _("virtual memory exhausted"));
+-
+- case 0:
+- /* Success. */
+- i = gl.gl_pathc;
+- nlist = (const char **)gl.gl_pathv;
+- break;
+-
+- case GLOB_NOMATCH:
+- /* If we want only existing items, skip this one. */
+- if (flags & PARSEFS_EXISTS)
+- {
+- i = 0;
+- break;
+- }
+- /* FALLTHROUGH */
+-
+- default:
+- /* By default keep this name. */
++ /* glob() is expensive: don't call it unless we need to. */
++ if (!(flags & PARSEFS_EXISTS) || strpbrk (name, "?*[") == NULL)
++ {
++ globme = 0;
+ i = 1;
+ nlist = &name;
+- break;
+- }
++ }
++ else
++ switch (glob (name, GLOB_NOSORT|GLOB_ALTDIRFUNC, NULL, &gl))
++ {
++ case GLOB_NOSPACE:
++ fatal (NILF, _("virtual memory exhausted"));
++
++ case 0:
++ /* Success. */
++ i = gl.gl_pathc;
++ nlist = (const char **)gl.gl_pathv;
++ break;
++
++ case GLOB_NOMATCH:
++ /* If we want only existing items, skip this one. */
++ if (flags & PARSEFS_EXISTS)
++ {
++ i = 0;
++ break;
++ }
++ /* FALLTHROUGH */
++
++ default:
++ /* By default keep this name. */
++ i = 1;
++ nlist = &name;
++ break;
++ }
+
+ /* For each matched element, add it to the list. */
+ while (i-- > 0)
+@@ -3174,7 +3183,8 @@
+ #endif /* !NO_ARCHIVES */
+ NEWELT (concat (2, prefix, nlist[i]));
+
+- globfree (&gl);
++ if (globme)
++ globfree (&gl);
+
+ #ifndef NO_ARCHIVES
+ if (arname)