aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2024-03-27 21:57:32 +0100
committerCorinna Vinschen <corinna@vinschen.de>2024-03-27 21:57:32 +0100
commitb7f5a33200a91ee76f5364280ad40bafedfab142 (patch)
treef47e620c16f4a0357d9305d8aa9ef2d449adb59b
parent7dd4eb1db9e1b1b9f14ef5b743705156e5f370e1 (diff)
Cygwin: //: fetch only one item per loop
Simplify code in that it only fetches a single entry per IEnumShellItems::Next call. For some reason this appears to be quicker most of the time. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
-rw-r--r--winsup/cygwin/fhandler/netdrive.cc22
1 files changed, 9 insertions, 13 deletions
diff --git a/winsup/cygwin/fhandler/netdrive.cc b/winsup/cygwin/fhandler/netdrive.cc
index 799ae9cb8..90e5a2217 100644
--- a/winsup/cygwin/fhandler/netdrive.cc
+++ b/winsup/cygwin/fhandler/netdrive.cc
@@ -234,24 +234,20 @@ thread_netdrive_wsd (void *arg)
do
{
- IShellItem *netitem[10] = { 0 };
+ IShellItem *netitem = NULL;
LPWSTR item_name = NULL;
- ULONG count;
- wres = netitem_enum->Next (10, netitem, &count);
- if (SUCCEEDED (wres) && count > 0)
+ wres = netitem_enum->Next (1, &netitem, NULL);
+ if (wres == S_OK)
{
- for (ULONG idx = 0; idx < count; ++idx)
+ if (netitem->GetDisplayName (SIGDN_PARENTRELATIVEPARSING,
+ &item_name) == S_OK)
{
- if (netitem[idx]->GetDisplayName (SIGDN_PARENTRELATIVEPARSING,
- &item_name) == S_OK)
- {
- /* Skip "\\" on server names and downcase */
- DIR_cache.add (item_name + 2, true);
- CoTaskMemFree (item_name);
- }
- netitem[idx]->Release ();
+ /* Skip "\\" on server names and downcase */
+ DIR_cache.add (item_name + 2, true);
+ CoTaskMemFree (item_name);
}
+ netitem->Release ();
}
}
while (wres == S_OK);