]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
* Configure.py: use #!/usr/local/bin/python
authorGuido van Rossum <guido@python.org>
Mon, 4 Jan 1993 09:09:59 +0000 (09:09 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 4 Jan 1993 09:09:59 +0000 (09:09 +0000)
* 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.

Include/allobjects.h
Modules/config.c.in
Modules/posixmodule.c
Modules/timemodule.c
Objects/listobject.c
Python/modsupport.c

index dd78a83f06afb98cd3b0e0dcdbdd7046403a5ac9..34232fd583052bff5bb4822d23f9764149346bfb 100644 (file)
@@ -52,5 +52,4 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #include "errors.h"
 #include "mymalloc.h"
 
-extern char *strdup PROTO((const char *));
 extern void fatal PROTO((char *));
index 6189c33eb02ad0f908d60c225f28a9b8854ac0e9..cfe82d731ae2a3e39328c01ad5c56c222c61f3da 100644 (file)
@@ -45,7 +45,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #ifdef __DATE__
 #define DATE __DATE__
 #else
-#define DATE ">= 10 Aug 1992"
+#define DATE ">= 1 Jan 1993"
 #endif
 
 #include <stdio.h>
index a263f1bdb8914ef47128bfbcd6ffd09c3cb16d53..e861d08ea8b87e208e2d217f0321663cb414fcc8 100644 (file)
@@ -75,7 +75,24 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #include "modsupport.h"
 #include "ceval.h"
 
+/* XXX Aren't these always declared in unistd.h? */
 extern char *strerror PROTO((int));
+extern int chmod PROTO((const char *, mode_t));
+extern char *getcwd PROTO((char *, int)); /* XXX or size_t? */
+extern int mkdir PROTO((const char *, mode_t));
+extern int chdir PROTO((const char *));
+extern int link PROTO((const char *, const char *));
+extern int rename PROTO((const char *, const char *));
+extern int rmdir PROTO((const char *));
+extern int stat PROTO((const char *, struct stat *));
+extern int unlink PROTO((const char *));
+extern int pclose PROTO((FILE *));
+#ifdef NO_LSTAT
+#define lstat stat
+#else
+extern int lstat PROTO((const char *, struct stat *));
+extern int symlink PROTO((const char *, const char *));
+#endif
 
 
 /* Return a dictionary corresponding to the POSIX environment table */
@@ -225,7 +242,6 @@ posix_chdir(self, args)
        object *self;
        object *args;
 {
-       extern int chdir PROTO((const char *));
        return posix_1str(args, chdir);
 }
 
@@ -234,7 +250,6 @@ posix_chmod(self, args)
        object *self;
        object *args;
 {
-       extern int chmod PROTO((const char *, mode_t));
        return posix_strint(args, chmod);
 }
 
@@ -245,7 +260,6 @@ posix_getcwd(self, args)
 {
        char buf[1026];
        char *res;
-       extern char *getcwd PROTO((char *, int));
        if (!getnoarg(args))
                return NULL;
        BGN_SAVE
@@ -262,7 +276,6 @@ posix_link(self, args)
        object *self;
        object *args;
 {
-       extern int link PROTO((const char *, const char *));
        return posix_2str(args, link);
 }
 #endif /* !MSDOS */
@@ -342,7 +355,6 @@ posix_mkdir(self, args)
        object *self;
        object *args;
 {
-       extern int mkdir PROTO((const char *, mode_t));
        return posix_strint(args, mkdir);
 }
 
@@ -366,7 +378,6 @@ posix_rename(self, args)
        object *self;
        object *args;
 {
-       extern int rename PROTO((const char *, const char *));
        return posix_2str(args, rename);
 }
 
@@ -375,7 +386,6 @@ posix_rmdir(self, args)
        object *self;
        object *args;
 {
-       extern int rmdir PROTO((const char *));
        return posix_1str(args, rmdir);
 }
 
@@ -384,7 +394,6 @@ posix_stat(self, args)
        object *self;
        object *args;
 {
-       extern int stat PROTO((const char *, struct stat *));
        return posix_do_stat(self, args, stat);
 }
 
@@ -424,19 +433,19 @@ posix_unlink(self, args)
        object *self;
        object *args;
 {
-       extern int unlink PROTO((const char *));
        return posix_1str(args, unlink);
 }
 
 #ifndef NO_UNAME
 #include <sys/utsname.h>
 
+extern int uname PROTO((struct utsname *));
+
 static object *
 posix_uname(self, args)
        object *self;
        object *args;
 {
-       extern int uname PROTO((struct utsname *));
        struct utsname u;
        object *v;
        int res;
@@ -696,7 +705,6 @@ posix_popen(self, args)
        object *self;
        object *args;
 {
-       extern int pclose PROTO((FILE *));
        char *name, *mode;
        FILE *fp;
        if (!getargs(args, "(ss)", &name, &mode))
@@ -759,10 +767,6 @@ posix_lstat(self, args)
        object *self;
        object *args;
 {
-#ifdef NO_LSTAT
-#define lstat stat
-#endif
-       extern int lstat PROTO((const char *, struct stat *));
        return posix_do_stat(self, args, lstat);
 }
 
@@ -798,7 +802,6 @@ posix_symlink(self, args)
        err_setstr(PosixError, "symlink not implemented on this system");
        return NULL;
 #else
-       extern int symlink PROTO((const char *, const char *));
        return posix_2str(args, symlink);
 #endif
 }
index 69a0c888238c976e44ac681fde53f9f93201ec94..17dff19626d177e38482c72193f44cb5911927b7 100644 (file)
@@ -33,6 +33,10 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #include <signal.h>
 #include <setjmp.h>
 
+#ifdef BSD_TIME
+#define HAVE_GETTIMEOFDAY
+#endif
+
 #ifdef macintosh
 #define NO_UNISTD
 #endif
@@ -79,6 +83,17 @@ time_time(self, args)
        object *self;
        object *args;
 {
+#ifdef HAVE_GETTIMEOFDAY
+       struct timeval t;
+       struct timezone tz;
+       if (!getnoarg(args))
+               return NULL;
+       if (gettimeofday(&t, &tz) != 0) {
+               err_errno(IOError);
+               return NULL;
+       }
+       return newfloatobject(t.tv_sec*1.0 + t.tv_usec*0.000001);
+#else /* !HAVE_GETTIMEOFDAY */
        time_t secs;
        if (!getnoarg(args))
                return NULL;
@@ -90,7 +105,8 @@ time_time(self, args)
        (((1970-1904)*365L + (1970-1904)/4) * 24 * 3600))
        secs -= TIMEDIFF;
 #endif
-       return newintobject((long)secs);
+       return newfloatobject((double)secs);
+#endif /* !HAVE_GETTIMEOFDAY */
 }
 
 static jmp_buf sleep_intr;
index d403a5e329c8eb7c630b527bbc6ddbea7f56c83d..d7d140f51314b773026e67148ccdeeaaf8e769f0 100644 (file)
@@ -479,7 +479,11 @@ static object *cmpfunc;
 
 static int
 cmp(v, w)
+#ifdef __STDC__
+       void *v, *w;
+#else
        char *v, *w;
+#endif
 {
        object *t, *res;
        long i;
index 1934cad52d2be54fc6ed58f80df0ed382daad912..1f281266c9f36d8a703b2d5176407cf7ecfe1b99 100644 (file)
@@ -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");