Commit ca3ed311 authored by Stefan Krah's avatar Stefan Krah

Merged revisions 86808 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r86808 | stefan.krah | 2010-11-26 17:16:47 +0100 (Fri, 26 Nov 2010) | 1 line

  Further indentation cleanup.
........
parent 0aed343c
...@@ -1852,7 +1852,7 @@ force write of file with filedescriptor to disk."); ...@@ -1852,7 +1852,7 @@ force write of file with filedescriptor to disk.");
static PyObject * static PyObject *
posix_fsync(PyObject *self, PyObject *fdobj) posix_fsync(PyObject *self, PyObject *fdobj)
{ {
return posix_fildes(fdobj, fsync); return posix_fildes(fdobj, fsync);
} }
#endif /* HAVE_FSYNC */ #endif /* HAVE_FSYNC */
...@@ -1870,7 +1870,7 @@ force write of file with filedescriptor to disk.\n\ ...@@ -1870,7 +1870,7 @@ force write of file with filedescriptor to disk.\n\
static PyObject * static PyObject *
posix_fdatasync(PyObject *self, PyObject *fdobj) posix_fdatasync(PyObject *self, PyObject *fdobj)
{ {
return posix_fildes(fdobj, fdatasync); return posix_fildes(fdobj, fdatasync);
} }
#endif /* HAVE_FDATASYNC */ #endif /* HAVE_FDATASYNC */
...@@ -2812,7 +2812,7 @@ posix_utime(PyObject *self, PyObject *args) ...@@ -2812,7 +2812,7 @@ posix_utime(PyObject *self, PyObject *args)
!SystemTimeToFileTime(&now, &atime)) { !SystemTimeToFileTime(&now, &atime)) {
win32_error("utime", NULL); win32_error("utime", NULL);
goto done; goto done;
} }
} }
else if (!PyTuple_Check(arg) || PyTuple_Size(arg) != 2) { else if (!PyTuple_Check(arg) || PyTuple_Size(arg) != 2) {
PyErr_SetString(PyExc_TypeError, PyErr_SetString(PyExc_TypeError,
...@@ -3934,9 +3934,9 @@ posix_getgroups(PyObject *self, PyObject *noargs) ...@@ -3934,9 +3934,9 @@ posix_getgroups(PyObject *self, PyObject *noargs)
for (i = 0; i < n; ++i) { for (i = 0; i < n; ++i) {
PyObject *o = PyInt_FromLong((long)alt_grouplist[i]); PyObject *o = PyInt_FromLong((long)alt_grouplist[i]);
if (o == NULL) { if (o == NULL) {
Py_DECREF(result); Py_DECREF(result);
result = NULL; result = NULL;
break; break;
} }
PyList_SET_ITEM(result, i, o); PyList_SET_ITEM(result, i, o);
} }
...@@ -7385,33 +7385,33 @@ conv_confname(PyObject *arg, int *valuep, struct constdef *table, ...@@ -7385,33 +7385,33 @@ conv_confname(PyObject *arg, int *valuep, struct constdef *table,
size_t tablesize) size_t tablesize)
{ {
if (PyInt_Check(arg)) { if (PyInt_Check(arg)) {
*valuep = PyInt_AS_LONG(arg); *valuep = PyInt_AS_LONG(arg);
return 1; return 1;
} }
if (PyString_Check(arg)) { if (PyString_Check(arg)) {
/* look up the value in the table using a binary search */ /* look up the value in the table using a binary search */
size_t lo = 0; size_t lo = 0;
size_t mid; size_t mid;
size_t hi = tablesize; size_t hi = tablesize;
int cmp; int cmp;
char *confname = PyString_AS_STRING(arg); char *confname = PyString_AS_STRING(arg);
while (lo < hi) { while (lo < hi) {
mid = (lo + hi) / 2; mid = (lo + hi) / 2;
cmp = strcmp(confname, table[mid].name); cmp = strcmp(confname, table[mid].name);
if (cmp < 0) if (cmp < 0)
hi = mid; hi = mid;
else if (cmp > 0) else if (cmp > 0)
lo = mid + 1; lo = mid + 1;
else { else {
*valuep = table[mid].value; *valuep = table[mid].value;
return 1; return 1;
}
} }
} PyErr_SetString(PyExc_ValueError, "unrecognized configuration name");
PyErr_SetString(PyExc_ValueError, "unrecognized configuration name");
} }
else else
PyErr_SetString(PyExc_TypeError, PyErr_SetString(PyExc_TypeError,
"configuration names must be strings or integers"); "configuration names must be strings or integers");
return 0; return 0;
} }
...@@ -7494,14 +7494,14 @@ posix_fpathconf(PyObject *self, PyObject *args) ...@@ -7494,14 +7494,14 @@ posix_fpathconf(PyObject *self, PyObject *args)
if (PyArg_ParseTuple(args, "iO&:fpathconf", &fd, if (PyArg_ParseTuple(args, "iO&:fpathconf", &fd,
conv_path_confname, &name)) { conv_path_confname, &name)) {
long limit; long limit;
errno = 0; errno = 0;
limit = fpathconf(fd, name); limit = fpathconf(fd, name);
if (limit == -1 && errno != 0) if (limit == -1 && errno != 0)
posix_error(); posix_error();
else else
result = PyInt_FromLong(limit); result = PyInt_FromLong(limit);
} }
return result; return result;
} }
...@@ -8320,21 +8320,21 @@ setup_confname_tables(PyObject *module) ...@@ -8320,21 +8320,21 @@ setup_confname_tables(PyObject *module)
sizeof(posix_constants_pathconf) sizeof(posix_constants_pathconf)
/ sizeof(struct constdef), / sizeof(struct constdef),
"pathconf_names", module)) "pathconf_names", module))
return -1; return -1;
#endif #endif
#ifdef HAVE_CONFSTR #ifdef HAVE_CONFSTR
if (setup_confname_table(posix_constants_confstr, if (setup_confname_table(posix_constants_confstr,
sizeof(posix_constants_confstr) sizeof(posix_constants_confstr)
/ sizeof(struct constdef), / sizeof(struct constdef),
"confstr_names", module)) "confstr_names", module))
return -1; return -1;
#endif #endif
#ifdef HAVE_SYSCONF #ifdef HAVE_SYSCONF
if (setup_confname_table(posix_constants_sysconf, if (setup_confname_table(posix_constants_sysconf,
sizeof(posix_constants_sysconf) sizeof(posix_constants_sysconf)
/ sizeof(struct constdef), / sizeof(struct constdef),
"sysconf_names", module)) "sysconf_names", module))
return -1; return -1;
#endif #endif
return 0; return 0;
} }
...@@ -8445,10 +8445,10 @@ posix_getloadavg(PyObject *self, PyObject *noargs) ...@@ -8445,10 +8445,10 @@ posix_getloadavg(PyObject *self, PyObject *noargs)
{ {
double loadavg[3]; double loadavg[3];
if (getloadavg(loadavg, 3)!=3) { if (getloadavg(loadavg, 3)!=3) {
PyErr_SetString(PyExc_OSError, "Load averages are unobtainable"); PyErr_SetString(PyExc_OSError, "Load averages are unobtainable");
return NULL; return NULL;
} else } else
return Py_BuildValue("ddd", loadavg[0], loadavg[1], loadavg[2]); return Py_BuildValue("ddd", loadavg[0], loadavg[1], loadavg[2]);
} }
#endif #endif
......
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