diff options
author | Guido van Rossum <guido@python.org> | 1993-01-04 09:09:59 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1993-01-04 09:09:59 (GMT) |
commit | a2b7f40513ba5d75a2063c3fabe47377cd8c0416 (patch) | |
tree | a49810320cbb0291ed16424b8d7ca980b5c2b1b1 /Python | |
parent | 349f2b516b89c46f915a57029ed2bd33f85ff363 (diff) | |
download | cpython-a2b7f40513ba5d75a2063c3fabe47377cd8c0416.zip cpython-a2b7f40513ba5d75a2063c3fabe47377cd8c0416.tar.gz cpython-a2b7f40513ba5d75a2063c3fabe47377cd8c0416.tar.bz2 |
* Configure.py: use #!/usr/local/bin/python
* posixmodule.c: move extern function declarations to top
* listobject.c: cmp() arguments must be void* if __STDC__
* Makefile, allobjects.h, panelmodule.c, modsupport.c: get rid of
strdup() -- it is a portability risk
* Makefile: enclosed ranlib command in parentheses for Sequent Make
which aborts if the command is not found even if '-' is present
* timemodule.c: time() returns a floating point number, in microsecond
precision if BSD_TIME is defined.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/modsupport.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Python/modsupport.c b/Python/modsupport.c index 1934cad..1f28126 100644 --- a/Python/modsupport.c +++ b/Python/modsupport.c @@ -46,17 +46,20 @@ initmodule(name, methods) { object *m, *d, *v; struct methodlist *ml; - char namebuf[256]; + char *namebuf; if ((m = add_module(name)) == NULL) { fprintf(stderr, "initializing module: %s\n", name); fatal("can't create a module"); } d = getmoduledict(m); for (ml = methods; ml->ml_name != NULL; ml++) { + namebuf = NEW(char, strlen(name) + strlen(ml->ml_name) + 2); + if (namebuf == NULL) + fatal("out of mem for method name"); sprintf(namebuf, "%s.%s", name, ml->ml_name); - v = newmethodobject(strdup(namebuf), ml->ml_meth, + v = newmethodobject(namebuf, ml->ml_meth, (object *)NULL, ml->ml_varargs); - /* XXX The strdup'ed memory is never freed */ + /* XXX The malloc'ed memory in namebuf is never freed */ if (v == NULL || dictinsert(d, ml->ml_name, v) != 0) { fprintf(stderr, "initializing module: %s\n", name); fatal("can't initialize module"); |