Mercurial > public > mercurial-scm > hg
diff mercurial/osutil.c @ 31468: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 | 0852161588c6 |
children | 95be8b7181d3 |
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; }