Skip to content

Commit d7a4288

Browse files
author
Fredrik Lundh
committed
renamed dispatch -> capi to match other CAPI implementations
(e.g. cStringIO, ucnhash, etc)
1 parent c334504 commit d7a4288

File tree

2 files changed

+27
-27
lines changed

2 files changed

+27
-27
lines changed

Include/pyexpat.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33

44
/* note: you must import expat.h before importing this module! */
55

6-
#define PyExpat_DISPATCH_MAGIC "pyexpat.dispatch 1.0"
6+
#define PyExpat_CAPI_MAGIC "pyexpat.expat_CAPI 1.0"
77

8-
struct PyExpat_Dispatch
8+
struct PyExpat_CAPI
99
{
10-
int size; /* set to sizeof(struct PyExpat_Dispatch) */
10+
int size; /* set to sizeof(struct PyExpat_CAPI) */
1111
int MAJOR_VERSION; /* XXX: use the ExpatVersionInfo instead? */
1212
int MINOR_VERSION;
1313
int MICRO_VERSION;

Modules/pyexpat.c

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1840,8 +1840,8 @@ MODULE_INITFUNC(void)
18401840
PyObject *modelmod_name;
18411841
PyObject *model_module;
18421842
PyObject *sys_modules;
1843-
static struct PyExpat_Dispatch dispatch;
1844-
PyObject* dispatch_object;
1843+
static struct PyExpat_CAPI capi;
1844+
PyObject* capi_object;
18451845

18461846
if (errmod_name == NULL)
18471847
return;
@@ -2017,31 +2017,31 @@ MODULE_INITFUNC(void)
20172017
#undef MYCONST
20182018

20192019
/* initialize pyexpat dispatch table */
2020-
dispatch.size = sizeof(dispatch);
2021-
dispatch.MAJOR_VERSION = XML_MAJOR_VERSION;
2022-
dispatch.MINOR_VERSION = XML_MINOR_VERSION;
2023-
dispatch.MICRO_VERSION = XML_MICRO_VERSION;
2024-
dispatch.ErrorString = XML_ErrorString;
2025-
dispatch.GetCurrentColumnNumber = XML_GetCurrentColumnNumber;
2026-
dispatch.GetCurrentLineNumber = XML_GetCurrentLineNumber;
2027-
dispatch.Parse = XML_Parse;
2028-
dispatch.ParserCreate_MM = XML_ParserCreate_MM;
2029-
dispatch.ParserFree = XML_ParserFree;
2030-
dispatch.SetCharacterDataHandler = XML_SetCharacterDataHandler;
2031-
dispatch.SetCommentHandler = XML_SetCommentHandler;
2032-
dispatch.SetDefaultHandlerExpand = XML_SetDefaultHandlerExpand;
2033-
dispatch.SetElementHandler = XML_SetElementHandler;
2034-
dispatch.SetNamespaceDeclHandler = XML_SetNamespaceDeclHandler;
2035-
dispatch.SetProcessingInstructionHandler = XML_SetProcessingInstructionHandler;
2036-
dispatch.SetUnknownEncodingHandler = XML_SetUnknownEncodingHandler;
2037-
dispatch.SetUserData = XML_SetUserData;
2020+
capi.size = sizeof(capi);
2021+
capi.MAJOR_VERSION = XML_MAJOR_VERSION;
2022+
capi.MINOR_VERSION = XML_MINOR_VERSION;
2023+
capi.MICRO_VERSION = XML_MICRO_VERSION;
2024+
capi.ErrorString = XML_ErrorString;
2025+
capi.GetCurrentColumnNumber = XML_GetCurrentColumnNumber;
2026+
capi.GetCurrentLineNumber = XML_GetCurrentLineNumber;
2027+
capi.Parse = XML_Parse;
2028+
capi.ParserCreate_MM = XML_ParserCreate_MM;
2029+
capi.ParserFree = XML_ParserFree;
2030+
capi.SetCharacterDataHandler = XML_SetCharacterDataHandler;
2031+
capi.SetCommentHandler = XML_SetCommentHandler;
2032+
capi.SetDefaultHandlerExpand = XML_SetDefaultHandlerExpand;
2033+
capi.SetElementHandler = XML_SetElementHandler;
2034+
capi.SetNamespaceDeclHandler = XML_SetNamespaceDeclHandler;
2035+
capi.SetProcessingInstructionHandler = XML_SetProcessingInstructionHandler;
2036+
capi.SetUnknownEncodingHandler = XML_SetUnknownEncodingHandler;
2037+
capi.SetUserData = XML_SetUserData;
20382038

20392039
/* export as cobject */
2040-
dispatch_object = PyCObject_FromVoidPtrAndDesc(
2041-
&dispatch, PyExpat_DISPATCH_MAGIC, NULL
2040+
capi_object = PyCObject_FromVoidPtrAndDesc(
2041+
&capi, PyExpat_CAPI_MAGIC, NULL
20422042
);
2043-
if (dispatch_object)
2044-
PyModule_AddObject(m, "dispatch", dispatch_object);
2043+
if (capi_object)
2044+
PyModule_AddObject(m, "expat_CAPI", capi_object);
20452045
}
20462046

20472047
static void

0 commit comments

Comments
 (0)