statfs: simplify handling of return value
authorYuya Nishihara <yuya@tcha.org>
Sat, 25 Mar 2017 17:13:12 +0900
changeset 31675 da191ba2576f
parent 31674 b33e352c365c
child 31676 f7aeb1f4b110
statfs: simplify handling of return value Py_BuildValue() can translate NULL pointer to None.
mercurial/osutil.c
--- 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) */