From b376a4ad1848d1319245f440c85ef265e1fef401 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Tue, 23 Nov 1993 17:53:17 +0000 Subject: [PATCH] * timemodule.c: Add hack for Solaris 2. * posixmodule.c: don't prototype getcwd() -- it's not portable... * mappingobject.c: double-check validity of last_name_char in dict{lookup,insert,remove}. * arraymodule.c: need memmove only for non-STDC Suns. * Makefile: comment out HTML_LIBS and XT_USE by default * pythonmain.c: don't prototype getopt() -- it's not standardized * socketmodule.c: cast flags arg to {get,set}sockopt() and addrbuf arg to recvfrom() to (ANY*). * pythonrun.c (initsigs): fix prototype, make it static * intobject.c (LONG_BIT): only #define it if not already defined * classobject.[ch]: remove all references to unused instance_convert() * mappingobject.c (getmappingsize): Don't return NULL in int function. --- Include/classobject.h | 2 -- Modules/arraymodule.c | 2 +- Modules/posixmodule.c | 4 ++-- Modules/socketmodule.c | 13 +++++++------ Modules/timemodule.c | 7 +++++++ Objects/classobject.c | 8 -------- Objects/dictobject.c | 9 +++++---- Objects/intobject.c | 2 ++ Objects/mappingobject.c | 9 +++++---- Python/pythonmain.c | 2 +- Python/pythonrun.c | 2 +- 11 files changed, 31 insertions(+), 29 deletions(-) diff --git a/Include/classobject.h b/Include/classobject.h index aa1cb6bf43c..a244ef80d9c 100644 --- a/Include/classobject.h +++ b/Include/classobject.h @@ -59,8 +59,6 @@ extern object *instancemethodgetfunc PROTO((object *)); extern object *instancemethodgetself PROTO((object *)); extern object *instancemethodgetclass PROTO((object *)); -extern object *instance_convert PROTO((object *, char *)); - extern int issubclass PROTO((object *, object *)); #ifdef __cplusplus diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c index 5b62fee4c02..925a52d2ef6 100644 --- a/Modules/arraymodule.c +++ b/Modules/arraymodule.c @@ -37,7 +37,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. extern char *memcpy(); #endif -#ifdef sun +#if defined(sun) && !defined(__STDC__) /* SunOS doesn't have memmove */ #define NEED_MEMMOVE extern char *memcpy(); diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 00b83698fff..b82e492f128 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -58,7 +58,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #ifdef SYSV -#define UTIME_STRUCT +#define UTIME_STRUCT 1 #include #define direct dirent #ifdef i386 @@ -89,7 +89,7 @@ extern int mkdir PROTO((const char *, mode_t)); extern int chdir PROTO((const char *)); extern int rmdir PROTO((const char *)); extern int chmod PROTO((const char *, mode_t)); -extern char *getcwd PROTO((char *, int)); /* XXX or size_t? */ +extern char *getcwd(); /* No PROTO((char *, int)) -- non portable */ #ifndef MSDOS extern char *strerror PROTO((int)); extern int link PROTO((const char *, const char *)); diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index dfdf97ba21d..3fc875535f0 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -388,7 +388,7 @@ sock_allowbroadcast(s, args) if (!getargs(args, "i", &flag)) return NULL; res = setsockopt(s->sock_fd, SOL_SOCKET, SO_BROADCAST, - &flag, sizeof flag); + (ANY *)&flag, sizeof flag); if (res < 0) return socket_error(); INCREF(None); @@ -422,7 +422,7 @@ sock_setsockopt(s, args) if (!getargs(args, "(iis#)", &level, &optname, &buf, &buflen)) return NULL; } - res = setsockopt(s->sock_fd, level, optname, buf, buflen); + res = setsockopt(s->sock_fd, level, optname, (ANY *)buf, buflen); if (res < 0) return socket_error(); INCREF(None); @@ -450,7 +450,8 @@ sock_getsockopt(s, args) if (getargs(args, "(ii)", &level, &optname)) { int flag = 0; int flagsize = sizeof flag; - res = getsockopt(s->sock_fd, level, optname, &flag, &flagsize); + res = getsockopt(s->sock_fd, level, optname, + (ANY *)&flag, &flagsize); if (res < 0) return socket_error(); return newintobject(flag); @@ -465,8 +466,8 @@ sock_getsockopt(s, args) buf = newsizedstringobject((char *)NULL, buflen); if (buf == NULL) return NULL; - res = getsockopt(s->sock_fd, level, optname, getstringvalue(buf), - &buflen); + res = getsockopt(s->sock_fd, level, optname, + (ANY *)getstringvalue(buf), &buflen); if (res < 0) { DECREF(buf); return socket_error(); @@ -720,7 +721,7 @@ sock_recvfrom(s, args) return NULL; BGN_SAVE n = recvfrom(s->sock_fd, getstringvalue(buf), len, flags, - addrbuf, &addrlen); + (ANY *)addrbuf, &addrlen); END_SAVE if (n < 0) return socket_error(); diff --git a/Modules/timemodule.c b/Modules/timemodule.c index 5bf1340caf3..5406907d670 100644 --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -72,6 +72,13 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #endif /* !unix */ #ifdef SYSV +#if defined(sun) && defined(__STDC__) +/* Temporary hack for Solaris 2. */ +#define _timezone timezone +#define _altzone altzone +#define _daylight daylight +#define _tzname tzname +#endif /* Access timezone stuff */ #ifdef OLDTZ /* ANSI prepends underscore to these */ #define _timezone timezone /* seconds to be added to GMT */ diff --git a/Objects/classobject.c b/Objects/classobject.c index 60089995df6..268cf1ac513 100644 --- a/Objects/classobject.c +++ b/Objects/classobject.c @@ -960,14 +960,6 @@ typeobject Instancetype = { instance_hash, /*tp_hash*/ }; -static object * -instance_convert(inst, methodname) - object *inst; - char *methodname; -{ - return generic_unary_op((instanceobject *)inst, methodname); -} - /* Instance method objects are used for two purposes: (a) as bound instance methods (returned by instancename.methodname) diff --git a/Objects/dictobject.c b/Objects/dictobject.c index 65512beb2b3..972560d57a1 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -572,7 +572,7 @@ getmappingsize(mp) { if (mp == NULL || !is_mappingobject(mp)) { err_badcall(); - return NULL; + return 0; } return ((mappingobject *)mp)->ma_used; } @@ -773,7 +773,7 @@ dictlookup(v, key) object *v; char *key; { - if (key != last_name_char) { + if (key != last_name_char || strcmp(key, getstringvalue(last_name_object)) != 0) { XDECREF(last_name_object); last_name_object = newstringobject(key); if (last_name_object == NULL) { @@ -791,7 +791,7 @@ dictinsert(v, key, item) char *key; object *item; { - if (key != last_name_char) { + if (key != last_name_char || strcmp(key, getstringvalue(last_name_object)) != 0) { XDECREF(last_name_object); last_name_object = newstringobject(key); if (last_name_object == NULL) { @@ -808,7 +808,8 @@ dictremove(v, key) object *v; char *key; { - if (key != last_name_char) { + if (key != last_name_char || + strcmp(key, getstringvalue(last_name_object)) != 0) { XDECREF(last_name_object); last_name_object = newstringobject(key); if (last_name_object == NULL) { diff --git a/Objects/intobject.c b/Objects/intobject.c index 2953ffad3c7..e9c35d7273d 100644 --- a/Objects/intobject.c +++ b/Objects/intobject.c @@ -43,7 +43,9 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #define CHAR_BIT 8 #endif +#ifndef LONG_BIT #define LONG_BIT (CHAR_BIT * sizeof(long)) +#endif /* Standard Booleans */ diff --git a/Objects/mappingobject.c b/Objects/mappingobject.c index 65512beb2b3..972560d57a1 100644 --- a/Objects/mappingobject.c +++ b/Objects/mappingobject.c @@ -572,7 +572,7 @@ getmappingsize(mp) { if (mp == NULL || !is_mappingobject(mp)) { err_badcall(); - return NULL; + return 0; } return ((mappingobject *)mp)->ma_used; } @@ -773,7 +773,7 @@ dictlookup(v, key) object *v; char *key; { - if (key != last_name_char) { + if (key != last_name_char || strcmp(key, getstringvalue(last_name_object)) != 0) { XDECREF(last_name_object); last_name_object = newstringobject(key); if (last_name_object == NULL) { @@ -791,7 +791,7 @@ dictinsert(v, key, item) char *key; object *item; { - if (key != last_name_char) { + if (key != last_name_char || strcmp(key, getstringvalue(last_name_object)) != 0) { XDECREF(last_name_object); last_name_object = newstringobject(key); if (last_name_object == NULL) { @@ -808,7 +808,8 @@ dictremove(v, key) object *v; char *key; { - if (key != last_name_char) { + if (key != last_name_char || + strcmp(key, getstringvalue(last_name_object)) != 0) { XDECREF(last_name_object); last_name_object = newstringobject(key); if (last_name_object == NULL) { diff --git a/Python/pythonmain.c b/Python/pythonmain.c index ac1d86a1bea..48ccd383090 100644 --- a/Python/pythonmain.c +++ b/Python/pythonmain.c @@ -33,7 +33,7 @@ extern int killprint; /* Defined in ceval.c */ /* Interface to getopt(): */ extern int optind; extern char *optarg; -extern int getopt PROTO((int, char **, char *)); +extern int getopt(); /* PROTO((int, char **, char *)); -- not standardized */ extern char *getenv(); diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 56254ac285d..ac7e0400a03 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -58,7 +58,7 @@ static object *run_node PROTO((node *n, char *filename, object *globals, object *locals)); static object *eval_node PROTO((node *n, char *filename, object *globals, object *locals)); -void initsigs PROTO(()); +static void initsigs PROTO((void)); int debugging; /* Needed by parser.c */ int verbose; /* Needed by import.c */