From: Guido van Rossum Date: Fri, 26 Oct 1990 14:59:30 +0000 (+0000) Subject: Take out duplication of code in initmodule(). X-Git-Tag: v0.9.8~1141 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=738d4ddf813d88de6d1c3c1c225857215fe7c13d;p=thirdparty%2FPython%2Fcpython.git Take out duplication of code in initmodule(). --- diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c index 400790f6b153..93b24fc2a71f 100644 --- a/Modules/mathmodule.c +++ b/Modules/mathmodule.c @@ -150,18 +150,9 @@ void initmath() { object *m, *d, *v; - struct methodlist *ml; - if ((m = new_module("math")) == NULL) - fatal("can't create math module"); + + m = initmodule("math", math_methods); d = getmoduledict(m); - for (ml = math_methods; ml->ml_name != NULL; ml++) { - v = newmethodobject(ml->ml_name, ml->ml_meth, (object *)NULL); - if (v == NULL || dictinsert(d, ml->ml_name, v) != 0) { - fatal("can't initialize math module"); - } - DECREF(v); - } dictinsert(d, "pi", newfloatobject(atan(1.0) * 4.0)); dictinsert(d, "e", newfloatobject(exp(1.0))); - DECREF(m); }