public inbox for cygwin-cvs@sourceware.org help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org> To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin/main] Cygwin: //: fetch only one item per loop Date: Wed, 27 Mar 2024 20:58:23 +0000 (GMT) [thread overview] Message-ID: <20240327205823.15F6E385C6F7@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=b7f5a33200a91ee76f5364280ad40bafedfab142 commit b7f5a33200a91ee76f5364280ad40bafedfab142 Author: Corinna Vinschen <corinna@vinschen.de> AuthorDate: Wed Mar 27 21:57:32 2024 +0100 Commit: Corinna Vinschen <corinna@vinschen.de> CommitDate: Wed Mar 27 21:57:32 2024 +0100 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> Diff: --- winsup/cygwin/fhandler/netdrive.cc | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/winsup/cygwin/fhandler/netdrive.cc b/winsup/cygwin/fhandler/netdrive.cc index 799ae9cb8e0b..90e5a22175d8 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);
reply other threads:[~2024-03-27 20:58 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20240327205823.15F6E385C6F7@sourceware.org \ --to=corinna@sourceware.org \ --cc=cygwin-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).