mirror of https://github.com/python/cpython
Fix a minor style consistency issue.
When getting a string buffer for a string we just created, use PyString_AS_STRING() instead of PyString_AsString() to avoid the call overhead and extra type check.
This commit is contained in:
parent
7e473800c3
commit
564a6cc8ca
|
@ -962,8 +962,8 @@ PySocketSock_getsockopt(PySocketSockObject *s, PyObject *args)
|
||||||
socklen_t buflen = 0;
|
socklen_t buflen = 0;
|
||||||
|
|
||||||
#ifdef __BEOS__
|
#ifdef __BEOS__
|
||||||
/* We have incomplete socket support. */
|
/* We have incomplete socket support. */
|
||||||
PyErr_SetString( PySocket_Error, "getsockopt not supported" );
|
PyErr_SetString(PySocket_Error, "getsockopt not supported");
|
||||||
return NULL;
|
return NULL;
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
@ -989,7 +989,7 @@ PySocketSock_getsockopt(PySocketSockObject *s, PyObject *args)
|
||||||
if (buf == NULL)
|
if (buf == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
res = getsockopt(s->sock_fd, level, optname,
|
res = getsockopt(s->sock_fd, level, optname,
|
||||||
(void *)PyString_AsString(buf), &buflen);
|
(void *)PyString_AS_STRING(buf), &buflen);
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
Py_DECREF(buf);
|
Py_DECREF(buf);
|
||||||
return PySocket_Err();
|
return PySocket_Err();
|
||||||
|
|
Loading…
Reference in New Issue