changeset 31675:da191ba2576f

statfs: simplify handling of return value Py_BuildValue() can translate NULL pointer to None.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 25 Mar 2017 17:13:12 +0900
parents b33e352c365c
children f7aeb1f4b110
files mercurial/osutil.c
diffstat 1 files changed, 1 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/osutil.c	Sat Mar 25 18:22:27 2017 +0900
+++ b/mercurial/osutil.c	Sat Mar 25 17:13:12 2017 +0900
@@ -1104,12 +1104,7 @@
 		return NULL;
 
 	memset(&buf, 0, sizeof(buf));
-	const char *type = getfstype(path, &buf);
-	if (type == NULL)
-		Py_RETURN_NONE;
-
-	PyObject *result = Py_BuildValue("s", type);
-	return result;
+	return Py_BuildValue("s", getfstype(path, &buf));
 }
 #endif /* defined(HAVE_LINUX_STATFS) || defined(HAVE_BSD_STATFS) */