changeset 31477:b9dd03ed564f

osutil: use Python memory allocator in _listdir The Python memory allocator has performance advantages for small allocations.
author Gregory Szorc <gregory.szorc@gmail.com>
date Thu, 09 Mar 2017 11:56:47 -0800
parents 08ecec297521
children a43fd9ec2a39
files mercurial/osutil.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/osutil.c	Thu Mar 09 11:54:25 2017 -0800
+++ b/mercurial/osutil.c	Thu Mar 09 11:56:47 2017 -0800
@@ -206,7 +206,7 @@
 	char *pattern;
 
 	/* build the path + \* pattern string */
-	pattern = malloc(plen + 3); /* path + \* + \0 */
+	pattern = PyMem_Malloc(plen + 3); /* path + \* + \0 */
 	if (!pattern) {
 		PyErr_NoMemory();
 		goto error_nomem;
@@ -269,7 +269,7 @@
 error_list:
 	FindClose(fh);
 error_file:
-	free(pattern);
+	PyMem_Free(pattern);
 error_nomem:
 	return rval;
 }