Commit 79e88936 authored by Fred Drake's avatar Fred Drake

Simplify initmd5() to use PyModule_AddIntConstant().

parent 0d4d6572
...@@ -268,13 +268,12 @@ static PyMethodDef md5_functions[] = { ...@@ -268,13 +268,12 @@ static PyMethodDef md5_functions[] = {
DL_EXPORT(void) DL_EXPORT(void)
initmd5(void) initmd5(void)
{ {
PyObject *m, *d, *i; PyObject *m, *d;
MD5type.ob_type = &PyType_Type; MD5type.ob_type = &PyType_Type;
m = Py_InitModule3("md5", md5_functions, module_doc); m = Py_InitModule3("md5", md5_functions, module_doc);
d = PyModule_GetDict(m); d = PyModule_GetDict(m);
PyDict_SetItemString(d, "MD5Type", (PyObject *)&MD5type); PyDict_SetItemString(d, "MD5Type", (PyObject *)&MD5type);
if ( (i = PyInt_FromLong(16)) != NULL) PyModule_AddIntConstant(m, "digest_size", 16);
PyDict_SetItemString(d, "digest_size", i);
/* No need to check the error here, the caller will do that */ /* No need to check the error here, the caller will do that */
} }
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