# HG changeset patch # User Yuya Nishihara # Date 2017-03-25 08:13:12 # Node ID da191ba2576f5d7c5f3ae01efb5f02dddc0d8a32 # Parent b33e352c365cc0cc05186b71e920100f233c7e6c 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 @@ -1104,12 +1104,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) */