[PATCH 1 of 2] cext: implement osutil.getfstype() on Windows

Yuya Nishihara yuya at tcha.org
Sat Dec 30 02:13:56 EST 2017


On Thu, 28 Dec 2017 18:31:38 -0500, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison at yahoo.com>
> # Date 1514442941 18000
> #      Thu Dec 28 01:35:41 2017 -0500
> # Node ID 452b23148c906aca4765d568263d9e3615cce228
> # Parent  95a9be56c3bb614fc1334a4cc8ec669f9eb7bc5a
> cext: implement osutil.getfstype() on Windows
> 
> This will allow NTFS to be added to the hardlink whitelist, and resume creating
> hardlinks in transactions (which was disabled globally in 07a92bbd02e5; see also
> e5ce49a30146).  I'll wait until this is accepted before implementing the pure
> version.

Perhaps we don't need a cext version if we'll reimplement it with ctypes.

> +	fullpath = calloc(size, sizeof(fullpath[0]));
> +	volume = calloc(size, sizeof(volume[0]));

Nit: no need to zero-fill?

> +	if (!fullpath || !volume) {
> +		PyErr_SetString(PyExc_MemoryError, "out of memory");
> +		goto bail;

Nit: PyErr_NoMemory() is preferred in our code.

> +bail:
> +	if (fullpath)
> +		free(fullpath);
> +	if (volume)
> +		free(volume);

Nit: free(NULL) is valid.


More information about the Mercurial-devel mailing list