Kaydet (Commit) 083d1f9f authored tarafından Mark Dickinson's avatar Mark Dickinson

Issue #5933: Fix gcc -Wextra compiler warnings (and remove some

trailing whitespace).
üst fd1ee7a8
...@@ -147,7 +147,7 @@ resource_setrlimit(PyObject *self, PyObject *args) ...@@ -147,7 +147,7 @@ resource_setrlimit(PyObject *self, PyObject *args)
int resource; int resource;
PyObject *curobj, *maxobj; PyObject *curobj, *maxobj;
if (!PyArg_ParseTuple(args, "i(OO):setrlimit", if (!PyArg_ParseTuple(args, "i(OO):setrlimit",
&resource, &curobj, &maxobj)) &resource, &curobj, &maxobj))
return NULL; return NULL;
...@@ -159,27 +159,27 @@ resource_setrlimit(PyObject *self, PyObject *args) ...@@ -159,27 +159,27 @@ resource_setrlimit(PyObject *self, PyObject *args)
#if !defined(HAVE_LARGEFILE_SUPPORT) #if !defined(HAVE_LARGEFILE_SUPPORT)
rl.rlim_cur = PyInt_AsLong(curobj); rl.rlim_cur = PyInt_AsLong(curobj);
if (rl.rlim_cur == -1 && PyErr_Occurred()) if (rl.rlim_cur == (rlim_t)-1 && PyErr_Occurred())
return NULL; return NULL;
rl.rlim_max = PyInt_AsLong(maxobj); rl.rlim_max = PyInt_AsLong(maxobj);
if (rl.rlim_max == -1 && PyErr_Occurred()) if (rl.rlim_max == (rlim_t)-1 && PyErr_Occurred())
return NULL; return NULL;
#else #else
/* The limits are probably bigger than a long */ /* The limits are probably bigger than a long */
rl.rlim_cur = PyLong_Check(curobj) ? rl.rlim_cur = PyLong_Check(curobj) ?
PyLong_AsLongLong(curobj) : PyInt_AsLong(curobj); PyLong_AsLongLong(curobj) : PyInt_AsLong(curobj);
if (rl.rlim_cur == -1 && PyErr_Occurred()) if (rl.rlim_cur == (rlim_t)-1 && PyErr_Occurred())
return NULL; return NULL;
rl.rlim_max = PyLong_Check(maxobj) ? rl.rlim_max = PyLong_Check(maxobj) ?
PyLong_AsLongLong(maxobj) : PyInt_AsLong(maxobj); PyLong_AsLongLong(maxobj) : PyInt_AsLong(maxobj);
if (rl.rlim_max == -1 && PyErr_Occurred()) if (rl.rlim_max == (rlim_t)-1 && PyErr_Occurred())
return NULL; return NULL;
#endif #endif
rl.rlim_cur = rl.rlim_cur & RLIM_INFINITY; rl.rlim_cur = rl.rlim_cur & RLIM_INFINITY;
rl.rlim_max = rl.rlim_max & RLIM_INFINITY; rl.rlim_max = rl.rlim_max & RLIM_INFINITY;
if (setrlimit(resource, &rl) == -1) { if (setrlimit(resource, &rl) == -1) {
if (errno == EINVAL) if (errno == EINVAL)
PyErr_SetString(PyExc_ValueError, PyErr_SetString(PyExc_ValueError,
"current limit exceeds maximum limit"); "current limit exceeds maximum limit");
else if (errno == EPERM) else if (errno == EPERM)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment