Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b376a4a

Browse files
committed
* 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.
1 parent 83eb962 commit b376a4a

11 files changed

Lines changed: 31 additions & 29 deletions

File tree

Include/classobject.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@ extern object *instancemethodgetfunc PROTO((object *));
5959
extern object *instancemethodgetself PROTO((object *));
6060
extern object *instancemethodgetclass PROTO((object *));
6161

62-
extern object *instance_convert PROTO((object *, char *));
63-
6462
extern int issubclass PROTO((object *, object *));
6563

6664
#ifdef __cplusplus

Modules/arraymodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
3737
extern char *memcpy();
3838
#endif
3939

40-
#ifdef sun
40+
#if defined(sun) && !defined(__STDC__)
4141
/* SunOS doesn't have memmove */
4242
#define NEED_MEMMOVE
4343
extern char *memcpy();

Modules/posixmodule.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
5858

5959
#ifdef SYSV
6060

61-
#define UTIME_STRUCT
61+
#define UTIME_STRUCT 1
6262
#include <dirent.h>
6363
#define direct dirent
6464
#ifdef i386
@@ -89,7 +89,7 @@ extern int mkdir PROTO((const char *, mode_t));
8989
extern int chdir PROTO((const char *));
9090
extern int rmdir PROTO((const char *));
9191
extern int chmod PROTO((const char *, mode_t));
92-
extern char *getcwd PROTO((char *, int)); /* XXX or size_t? */
92+
extern char *getcwd(); /* No PROTO((char *, int)) -- non portable */
9393
#ifndef MSDOS
9494
extern char *strerror PROTO((int));
9595
extern int link PROTO((const char *, const char *));

Modules/socketmodule.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ sock_allowbroadcast(s, args)
388388
if (!getargs(args, "i", &flag))
389389
return NULL;
390390
res = setsockopt(s->sock_fd, SOL_SOCKET, SO_BROADCAST,
391-
&flag, sizeof flag);
391+
(ANY *)&flag, sizeof flag);
392392
if (res < 0)
393393
return socket_error();
394394
INCREF(None);
@@ -422,7 +422,7 @@ sock_setsockopt(s, args)
422422
if (!getargs(args, "(iis#)", &level, &optname, &buf, &buflen))
423423
return NULL;
424424
}
425-
res = setsockopt(s->sock_fd, level, optname, buf, buflen);
425+
res = setsockopt(s->sock_fd, level, optname, (ANY *)buf, buflen);
426426
if (res < 0)
427427
return socket_error();
428428
INCREF(None);
@@ -450,7 +450,8 @@ sock_getsockopt(s, args)
450450
if (getargs(args, "(ii)", &level, &optname)) {
451451
int flag = 0;
452452
int flagsize = sizeof flag;
453-
res = getsockopt(s->sock_fd, level, optname, &flag, &flagsize);
453+
res = getsockopt(s->sock_fd, level, optname,
454+
(ANY *)&flag, &flagsize);
454455
if (res < 0)
455456
return socket_error();
456457
return newintobject(flag);
@@ -465,8 +466,8 @@ sock_getsockopt(s, args)
465466
buf = newsizedstringobject((char *)NULL, buflen);
466467
if (buf == NULL)
467468
return NULL;
468-
res = getsockopt(s->sock_fd, level, optname, getstringvalue(buf),
469-
&buflen);
469+
res = getsockopt(s->sock_fd, level, optname,
470+
(ANY *)getstringvalue(buf), &buflen);
470471
if (res < 0) {
471472
DECREF(buf);
472473
return socket_error();
@@ -720,7 +721,7 @@ sock_recvfrom(s, args)
720721
return NULL;
721722
BGN_SAVE
722723
n = recvfrom(s->sock_fd, getstringvalue(buf), len, flags,
723-
addrbuf, &addrlen);
724+
(ANY *)addrbuf, &addrlen);
724725
END_SAVE
725726
if (n < 0)
726727
return socket_error();

Modules/timemodule.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
7272
#endif /* !unix */
7373

7474
#ifdef SYSV
75+
#if defined(sun) && defined(__STDC__)
76+
/* Temporary hack for Solaris 2. */
77+
#define _timezone timezone
78+
#define _altzone altzone
79+
#define _daylight daylight
80+
#define _tzname tzname
81+
#endif
7582
/* Access timezone stuff */
7683
#ifdef OLDTZ /* ANSI prepends underscore to these */
7784
#define _timezone timezone /* seconds to be added to GMT */

Objects/classobject.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -960,14 +960,6 @@ typeobject Instancetype = {
960960
instance_hash, /*tp_hash*/
961961
};
962962

963-
static object *
964-
instance_convert(inst, methodname)
965-
object *inst;
966-
char *methodname;
967-
{
968-
return generic_unary_op((instanceobject *)inst, methodname);
969-
}
970-
971963

972964
/* Instance method objects are used for two purposes:
973965
(a) as bound instance methods (returned by instancename.methodname)

Objects/dictobject.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ getmappingsize(mp)
572572
{
573573
if (mp == NULL || !is_mappingobject(mp)) {
574574
err_badcall();
575-
return NULL;
575+
return 0;
576576
}
577577
return ((mappingobject *)mp)->ma_used;
578578
}
@@ -773,7 +773,7 @@ dictlookup(v, key)
773773
object *v;
774774
char *key;
775775
{
776-
if (key != last_name_char) {
776+
if (key != last_name_char || strcmp(key, getstringvalue(last_name_object)) != 0) {
777777
XDECREF(last_name_object);
778778
last_name_object = newstringobject(key);
779779
if (last_name_object == NULL) {
@@ -791,7 +791,7 @@ dictinsert(v, key, item)
791791
char *key;
792792
object *item;
793793
{
794-
if (key != last_name_char) {
794+
if (key != last_name_char || strcmp(key, getstringvalue(last_name_object)) != 0) {
795795
XDECREF(last_name_object);
796796
last_name_object = newstringobject(key);
797797
if (last_name_object == NULL) {
@@ -808,7 +808,8 @@ dictremove(v, key)
808808
object *v;
809809
char *key;
810810
{
811-
if (key != last_name_char) {
811+
if (key != last_name_char ||
812+
strcmp(key, getstringvalue(last_name_object)) != 0) {
812813
XDECREF(last_name_object);
813814
last_name_object = newstringobject(key);
814815
if (last_name_object == NULL) {

Objects/intobject.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
4343
#define CHAR_BIT 8
4444
#endif
4545

46+
#ifndef LONG_BIT
4647
#define LONG_BIT (CHAR_BIT * sizeof(long))
48+
#endif
4749

4850
/* Standard Booleans */
4951

Objects/mappingobject.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ getmappingsize(mp)
572572
{
573573
if (mp == NULL || !is_mappingobject(mp)) {
574574
err_badcall();
575-
return NULL;
575+
return 0;
576576
}
577577
return ((mappingobject *)mp)->ma_used;
578578
}
@@ -773,7 +773,7 @@ dictlookup(v, key)
773773
object *v;
774774
char *key;
775775
{
776-
if (key != last_name_char) {
776+
if (key != last_name_char || strcmp(key, getstringvalue(last_name_object)) != 0) {
777777
XDECREF(last_name_object);
778778
last_name_object = newstringobject(key);
779779
if (last_name_object == NULL) {
@@ -791,7 +791,7 @@ dictinsert(v, key, item)
791791
char *key;
792792
object *item;
793793
{
794-
if (key != last_name_char) {
794+
if (key != last_name_char || strcmp(key, getstringvalue(last_name_object)) != 0) {
795795
XDECREF(last_name_object);
796796
last_name_object = newstringobject(key);
797797
if (last_name_object == NULL) {
@@ -808,7 +808,8 @@ dictremove(v, key)
808808
object *v;
809809
char *key;
810810
{
811-
if (key != last_name_char) {
811+
if (key != last_name_char ||
812+
strcmp(key, getstringvalue(last_name_object)) != 0) {
812813
XDECREF(last_name_object);
813814
last_name_object = newstringobject(key);
814815
if (last_name_object == NULL) {

Python/pythonmain.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ extern int killprint; /* Defined in ceval.c */
3333
/* Interface to getopt(): */
3434
extern int optind;
3535
extern char *optarg;
36-
extern int getopt PROTO((int, char **, char *));
36+
extern int getopt(); /* PROTO((int, char **, char *)); -- not standardized */
3737

3838
extern char *getenv();
3939

0 commit comments

Comments
 (0)