[PATCH 2 of 5] statfs: simplify handling of return value
Yuya Nishihara
yuya at tcha.org
Sat Mar 25 06:38:48 EDT 2017
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1490429592 -32400
# Sat Mar 25 17:13:12 2017 +0900
# Node ID ca3ea70b04791670fa70eabc2531629b4d82d7a2
# Parent 32202fca1b0a8f3dd4debb9b35daff002c454f75
statfs: simplify handling of return value
Py_BuildValue() can translate NULL pointer to None.
diff --git a/mercurial/osutil.c b/mercurial/osutil.c
--- a/mercurial/osutil.c
+++ b/mercurial/osutil.c
@@ -1088,12 +1088,7 @@ static PyObject *pygetfstype(PyObject *s
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) */
More information about the Mercurial-devel
mailing list