Kaydet (Commit) 6f5505aa authored tarafından Tim Peters's avatar Tim Peters

For readability, switch to tab indents; was using a mix of tab indents,

4-space indents, and ambiguous space+tab indents.  Added an XXX comment
about a confusing part.  Still doesn't build on Windows.
üst a5854c24
...@@ -70,7 +70,7 @@ typedef struct { ...@@ -70,7 +70,7 @@ typedef struct {
struct sockaddr_ll ll; struct sockaddr_ll ll;
#endif #endif
} sock_addr; } sock_addr;
PyObject *(*errorhandler)(void); /* Error handler; checks PyObject *(*errorhandler)(void); /* Error handler; checks
errno, returns NULL and errno, returns NULL and
sets a Python exception */ sets a Python exception */
} PySocketSockObject; } PySocketSockObject;
...@@ -86,11 +86,12 @@ extern DL_IMPORT(PyTypeObject) PySocketSock_Type; ...@@ -86,11 +86,12 @@ extern DL_IMPORT(PyTypeObject) PySocketSock_Type;
/* C API for usage by other Python modules */ /* C API for usage by other Python modules */
typedef struct { typedef struct {
PyTypeObject *Sock_Type;
PyTypeObject *Sock_Type;
} PySocketModule_APIObject; } PySocketModule_APIObject;
/* XXX The net effect of the following appears to be to define a function
XXX named PySocketModule_APIObject in _ssl.c. It's unclear why it isn't
XXX defined there directly. */
#ifndef PySocket_BUILDING_SOCKET #ifndef PySocket_BUILDING_SOCKET
/* --- C API ----------------------------------------------------*/ /* --- C API ----------------------------------------------------*/
...@@ -104,10 +105,9 @@ typedef struct { ...@@ -104,10 +105,9 @@ typedef struct {
&key_file, &cert_file)) &key_file, &cert_file))
return NULL; return NULL;
... ...
*/ */
static static
PySocketModule_APIObject PySocketModule; PySocketModule_APIObject PySocketModule;
/* You *must* call this before using any of the functions in /* You *must* call this before using any of the functions in
...@@ -121,37 +121,37 @@ PySocketModule_APIObject PySocketModule; ...@@ -121,37 +121,37 @@ PySocketModule_APIObject PySocketModule;
static static
int PySocketModule_ImportModuleAndAPI(void) int PySocketModule_ImportModuleAndAPI(void)
{ {
PyObject *mod = 0, *v = 0; PyObject *mod = 0, *v = 0;
char *apimodule = PySocket_MODULE_NAME; char *apimodule = PySocket_MODULE_NAME;
char *apiname = PySocket_CAPI_NAME; char *apiname = PySocket_CAPI_NAME;
void *api; void *api;
DPRINTF("Importing the %s C API...\n",apimodule); DPRINTF("Importing the %s C API...\n", apimodule);
mod = PyImport_ImportModule(apimodule); mod = PyImport_ImportModule(apimodule);
if (mod == NULL) if (mod == NULL)
goto onError; goto onError;
DPRINTF(" %s package found\n",apimodule); DPRINTF(" %s package found\n", apimodule);
v = PyObject_GetAttrString(mod,apiname); v = PyObject_GetAttrString(mod, apiname);
if (v == NULL) if (v == NULL)
goto onError; goto onError;
Py_DECREF(mod); Py_DECREF(mod);
DPRINTF(" API object %s found\n",apiname); DPRINTF(" API object %s found\n", apiname);
api = PyCObject_AsVoidPtr(v); api = PyCObject_AsVoidPtr(v);
if (api == NULL) if (api == NULL)
goto onError; goto onError;
Py_DECREF(v); Py_DECREF(v);
memcpy(&PySocketModule, api, sizeof(PySocketModule)); memcpy(&PySocketModule, api, sizeof(PySocketModule));
DPRINTF(" API object loaded and initialized.\n"); DPRINTF(" API object loaded and initialized.\n");
return 0; return 0;
onError: onError:
DPRINTF(" not found.\n"); DPRINTF(" not found.\n");
Py_XDECREF(mod); Py_XDECREF(mod);
Py_XDECREF(v); Py_XDECREF(v);
return -1; return -1;
} }
#endif #endif /* !PySocket_BUILDING_SOCKET */
#ifdef __cplusplus #ifdef __cplusplus
} }
......
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