From c65a525cdc9ce2e0af56e1a75deb877e935cee2f Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Fri, 5 Aug 1994 13:44:50 +0000 Subject: [PATCH] * Modules/{Setup.in,Makefile.pre.in}: renamed some modules to shorter names (dropped the "module" from the name): sunaudiodev, imgformat, audioop, imageop, imgfile * Modules/stropmodule.c (strop_rindex): make rindex('abc', '') do the right thing (i.e. return 3 instead of 0) * Modules/socketmodule.c: disabled allowbroadcast() socket method --- Modules/Makefile.pre.in | 8 ++++---- Modules/Setup.in | 10 +++++----- Modules/regexpr.c | 7 +++++++ Modules/socketmodule.c | 4 ++++ Modules/stropmodule.c | 2 +- 5 files changed, 21 insertions(+), 10 deletions(-) diff --git a/Modules/Makefile.pre.in b/Modules/Makefile.pre.in index 0b4fa5b531c..7ef0b0b163a 100644 --- a/Modules/Makefile.pre.in +++ b/Modules/Makefile.pre.in @@ -98,7 +98,7 @@ glmodule.c: $(srcdir)/cgen.py $(srcdir)/cstubs almodule.o: almodule.c arraymodule.o: arraymodule.c -audioopmodule.o: audioopmodule.c +audioop.o: audioop.c cdmodule.o: cdmodule.c clmodule.o: clmodule.c dbmmodule.o: dbmmodule.c @@ -106,8 +106,8 @@ fcntlmodule.o: fcntlmodule.c flmodule.o: flmodule.c fmmodule.o: fmmodule.c glmodule.o: glmodule.c -imageopmodule.o: imageopmodule.c -imgfilemodule.o: imgfilemodule.c +imageop.o: imageop.c +imgfile.o: imgfile.c mathmodule.o: mathmodule.c md5c.o: md5c.c md5module.o: md5module.c @@ -126,7 +126,7 @@ socketmodule.o: socketmodule.c stdwinmodule.o: stdwinmodule.c stropmodule.o: stropmodule.c structmodule.o: structmodule.c -sunaudiodevmodule.o: sunaudiodevmodule.c +sunaudiodev.o: sunaudiodev.c svmodule.o: svmodule.c threadmodule.o: threadmodule.c timemodule.o: timemodule.c diff --git a/Modules/Setup.in b/Modules/Setup.in index f7b5bace3d9..171755c5f82 100644 --- a/Modules/Setup.in +++ b/Modules/Setup.in @@ -93,8 +93,8 @@ socket socketmodule.o # socket(2); not on ancient System V # Multimedia modules -- on by default. # These represent audio samples or images as strings -audioop audioopmodule.o # Operations on audio samples -imageop imageopmodule.o # Operations on images +audioop audioop.o # Operations on audio samples +imageop imageop.o # Operations on images rgbimg rgbimgmodule.o # Read SGI RGB image files (but coded portably) @@ -148,7 +148,7 @@ rotor rotormodule.o #cl clmodule.o -lcl # -lawareaudio #fm fmmodule.o -lfm_s -lgl_s #gl glmodule.o -lgl_s -lX11_s -#imgfile imgfilemodule.o -limage -lgutil +#imgfile imgfile.o -limage -lgutil #sgi sgimodule.o #sv svmodule.o yuvconvert.o -lsvideo -lXext -lX11_s @@ -165,7 +165,7 @@ rotor rotormodule.o # SunOS specific modules -- off by default -# sunaudiodev sunaudiodevmodule.o +# sunaudiodev sunaudiodev.o # Thread module -- works on SGI IRIX and on SunOS 5.x (SOLARIS) only. @@ -196,7 +196,7 @@ rotor rotormodule.o # Jack Jansen's imgformat module -# imgformat imgformatmodule.o +# imgformat imgformat.o # Lance Ellinghouse's syslog module diff --git a/Modules/regexpr.c b/Modules/regexpr.c index f87755870e1..841f500d095 100644 --- a/Modules/regexpr.c +++ b/Modules/regexpr.c @@ -1251,6 +1251,11 @@ regexp_registers_t regs; goto error; failure_stack_start = (struct failure_point *) malloc(MAX_FAILURES * sizeof(*failure_stack_start)); + if (failure_stack_start == NULL) + { + failure_stack_start = initial_failure_stack; + goto error; + } failure_stack_end = failure_stack_start + MAX_FAILURES; memcpy((char *)failure_stack_start, (char *)initial_failure_stack, INITIAL_FAILURES * sizeof(*failure_stack_start)); @@ -1529,6 +1534,8 @@ char *s; /* the buffer will be allocated automatically */ re_comp_buf.fastmap = malloc(256); re_comp_buf.translate = NULL; + if (re_comp_buf.fastmap == NULL) + return "Out of memory"; } return re_compile_pattern(s, strlen(s), &re_comp_buf); } diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 32f22db8272..6340fbcc73b 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -380,6 +380,7 @@ sock_accept(s, args) } +#if 0 /* s.allowbroadcast() method */ /* XXX obsolete -- will disappear in next release */ @@ -399,6 +400,7 @@ sock_allowbroadcast(s, args) INCREF(None); return None; } +#endif /* s.setsockopt() method. @@ -796,7 +798,9 @@ sock_shutdown(s, args) static struct methodlist sock_methods[] = { {"accept", (method)sock_accept}, +#if 0 {"allowbroadcast", (method)sock_allowbroadcast}, +#endif {"setsockopt", (method)sock_setsockopt}, {"getsockopt", (method)sock_getsockopt}, {"bind", (method)sock_bind}, diff --git a/Modules/stropmodule.c b/Modules/stropmodule.c index c9802727952..0fd09b06d3c 100644 --- a/Modules/stropmodule.c +++ b/Modules/stropmodule.c @@ -256,7 +256,7 @@ strop_rindex(self, args) } if (n == 0) - return newintobject((long)i); + return newintobject((long)len); for (j = len-n; j >= i; --j) if (s[j] == sub[0] &&