else if (STRCMP(r->ops->name, ==, "sslprf")) ty = sslprf_pytype;
else if (STRCMP(r->ops->name, ==, "tlsdx")) ty = tlsdx_pytype;
else if (STRCMP(r->ops->name, ==, "tlsprf")) ty = tlsprf_pytype;
- else if ((ob = PyDict_GetItemString(gccrands_dict, r->ops->name)) != 0)
+ else if ((ob = PyMapping_GetItemString
+ (gccrands_dict, (/*unconst*/ char *)r->ops->name)) != 0)
ty = (PyTypeObject *)ob;
return (grand_dopywrap(ty, r, f));
}
rand_seed(RAND_GLOBAL, 160);
}
-#define gccrand gccrand_info
-GEN(gccrands, crand)
+static const char *crand_namefn(const void *p)
+ { const gccrand_info *const *cls = p; return (*cls ? (*cls)->name : 0); }
+static PyObject *crand_valfn(const void *p)
+ { const gccrand_info *const *cls = p; return (gccrand_pywrap(*cls)); }
void rand_pyinsert(PyObject *mod)
{
INSERT("GCRand", gcrand_pytype);
INSERT("GCLatinRand", gclatinrand_pytype);
rand_pyobj = grand_pywrap(&rand_global, 0); Py_INCREF(rand_pyobj);
- gccrands_dict = gccrands(); Py_INCREF(gccrands_dict);
- INSERT("gccrands", gccrands_dict);
+ gccrands_dict = make_algtab(gcrandtab, sizeof(gccrand_info *),
+ crand_namefn, crand_valfn);
+ INSERT("gccrands", gccrands_dict); Py_INCREF(gccrands_dict);
INSERT("rand", rand_pyobj);
setconstants(mod, consts);
}