Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 286365 Details for
Bug 382845
sys-devel/make: glob speedups from upstream
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
glob-speedup.patch
make-glob-speedup.patch (text/plain), 2.69 KB, created by
Tomáš Chvátal (RETIRED)
on 2011-09-13 16:42:10 UTC
(
hide
)
Description:
glob-speedup.patch
Filename:
MIME Type:
Creator:
Tomáš Chvátal (RETIRED)
Created:
2011-09-13 16:42:10 UTC
Size:
2.69 KB
patch
obsolete
>From c62f3e6808870645dc9a94dc27158ca3bec16fbd Mon Sep 17 00:00:00 2001 >From: Michael Meeks <michael.meeks@novell.com> >Date: Tue, 06 Sep 2011 15:29:26 +0000 >Subject: add major glob speedup from make cvs diff -r 1.198 -r 1.200 read.c > >--- >diff --git a/make-3.82-gbuild/read.c b/make-3.82-gbuild/read.c >index a3ad88e..858b295 100644 >--- a/make-3.82-gbuild/read.c >+++ b/make-3.82-gbuild/read.c >@@ -2904,6 +2904,7 @@ parse_file_seq (char **stringp, unsigned int size, int stopchar, > const char *name; > const char **nlist = 0; > char *tildep = 0; >+ int globme = 1; > #ifndef NO_ARCHIVES > char *arname = 0; > char *memname = 0; >@@ -3112,32 +3113,40 @@ parse_file_seq (char **stringp, unsigned int size, int stopchar, > } > #endif /* !NO_ARCHIVES */ > >- switch (glob (name, GLOB_NOSORT|GLOB_ALTDIRFUNC, NULL, &gl)) >- { >- case GLOB_NOSPACE: >- fatal (NILF, _("virtual memory exhausted")); >+ /* glob() is expensive: don't call it unless we need to. */ >+ if (!(flags & PARSEFS_EXISTS) && strpbrk (name, "?*[") == NULL) >+ { >+ globme = 0; >+ i = 1; >+ nlist = &name; >+ } >+ 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 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 */ >+ 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; >- } >+ 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 @@ parse_file_seq (char **stringp, unsigned int size, int stopchar, > #endif /* !NO_ARCHIVES */ > NEWELT (concat (2, prefix, nlist[i])); > >- globfree (&gl); >+ if (globme) >+ globfree (&gl); > > #ifndef NO_ARCHIVES > if (arname) >-- >cgit v0.9.0.2-2-gbebe
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 382845
: 286365