Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 564a6cc

Browse files
committed
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.
1 parent 7e47380 commit 564a6cc

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Modules/socketmodule.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -962,8 +962,8 @@ PySocketSock_getsockopt(PySocketSockObject *s, PyObject *args)
962962
socklen_t buflen = 0;
963963

964964
#ifdef __BEOS__
965-
/* We have incomplete socket support. */
966-
PyErr_SetString( PySocket_Error, "getsockopt not supported" );
965+
/* We have incomplete socket support. */
966+
PyErr_SetString(PySocket_Error, "getsockopt not supported");
967967
return NULL;
968968
#else
969969

@@ -989,7 +989,7 @@ PySocketSock_getsockopt(PySocketSockObject *s, PyObject *args)
989989
if (buf == NULL)
990990
return NULL;
991991
res = getsockopt(s->sock_fd, level, optname,
992-
(void *)PyString_AsString(buf), &buflen);
992+
(void *)PyString_AS_STRING(buf), &buflen);
993993
if (res < 0) {
994994
Py_DECREF(buf);
995995
return PySocket_Err();

0 commit comments

Comments
 (0)