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] Cygwin: mount_info::get_mounts_here: alloc temp mountpoint info on cygheap
Date: Fri,  5 Aug 2022 10:01:53 +0000 (GMT)	[thread overview]
Message-ID: <20220805100153.C6AD73858C53@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=1e428bee1c5ef7c76ba4e46e6693b913edc9bbf3

commit 1e428bee1c5ef7c76ba4e46e6693b913edc9bbf3
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Fri Aug 5 12:01:45 2022 +0200

    Cygwin: mount_info::get_mounts_here: alloc temp mountpoint info on cygheap
    
    That *should* be slightly faster than allocating on the user heap.
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/mount.cc | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/winsup/cygwin/mount.cc b/winsup/cygwin/mount.cc
index 76d1e9a6d..63c9d2874 100644
--- a/winsup/cygwin/mount.cc
+++ b/winsup/cygwin/mount.cc
@@ -739,15 +739,15 @@ mount_info::get_mounts_here (const char *parent_dir, size_t parent_dir_len,
       if (last_slash == mi->posix_path)
 	{
 	  if (parent_dir_len == 1 && mi->posix_pathlen > 1)
-	    sys_mbstouni_alloc (&mount_points[n_mounts++], HEAP_NOTHEAP,
+	    sys_mbstouni_alloc (&mount_points[n_mounts++], HEAP_BUF,
 			        last_slash + 1);
 	}
       else if (parent_dir_len == (size_t) (last_slash - mi->posix_path)
 	       && strncasematch (parent_dir, mi->posix_path, parent_dir_len))
-	sys_mbstouni_alloc (&mount_points[n_mounts++], HEAP_NOTHEAP,
+	sys_mbstouni_alloc (&mount_points[n_mounts++], HEAP_BUF,
 			    last_slash + 1);
     }
-  sys_mbstouni_alloc (cygd, HEAP_NOTHEAP, cygdrive + 1);
+  sys_mbstouni_alloc (cygd, HEAP_BUF, cygdrive + 1);
   if (cygd->Length)
     cygd->Length -= 2;	// Strip trailing slash
   return n_mounts;
@@ -758,8 +758,8 @@ mount_info::free_mounts_here (PUNICODE_STRING mount_points, int n_mounts,
 			      PUNICODE_STRING cygd)
 {
   for (int i = 0; i < n_mounts; ++i)
-    free (mount_points[i].Buffer);
-  free (cygd->Buffer);
+    cfree (mount_points[i].Buffer);
+  cfree (cygd->Buffer);
 }
 
 /* cygdrive_posix_path: Build POSIX path used as the


                 reply	other threads:[~2022-08-05 10:01 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=20220805100153.C6AD73858C53@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: link
Be 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).