Summary: | kpropertiesdialog should use getgrouplist() instead of enumerating all groups | ||
---|---|---|---|
Product: | [Frameworks and Libraries] kio | Reporter: | andreas |
Component: | kfile | Assignee: | David Faure <faure> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | faure |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Conectiva RPMs | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Attachments: |
kde-groupenum.patch
kde-groupenum.patch |
Description
andreas
2004-09-16 19:29:33 UTC
The particular piece of code in question: kpropertiesdialog.cpp:1633 setgrent(); for (i=0; ((ge = getgrent()) != 0L) && (i < maxEntries); i++) { if (IamRoot) groupList += QString::fromLatin1(ge->gr_name); else { /* pick the groups to which the user belongs */ char ** members = ge->gr_mem; char * member; while ((member = *members) != 0L) { if (strUser == member) { groupList += QString::fromLocal8Bit(ge->gr_name); break; } ++members; } } } endgrent(); Got a patch? Created attachment 7635 [details]
kde-groupenum.patch
I'm about to try this patch. I don't know if it works yet, please take a look.
Created attachment 7938 [details]
kde-groupenum.patch
Slightly modified version. I tested this and it gave quite a performance boost
as expected (38s vs. <1s more or less) in my testcase.
It still needs work, though, I'm not a good coder, just a problem spotter :)
realloc should be used, or some other qt/kde memory management function. The
first malloc is also never checked. I hope this is enough for some kde
developer to carry on, though.
SVN commit 935835 by dfaure: Use getgrouplist() instead of enumerating all groups with setgrent/getgrent, which can be really slow with centralized setups (e.g. winbind) Based on patch by andreas at conectiva - thanks! (code simplified and made more C++). Fix will be in 4.2.2. BUG: 89646 M +17 -29 kpropertiesdialog.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=935835 |