From 4de1657d11fd3044f8022c8617f4fa63f2bec302 Mon Sep 17 00:00:00 2001 From: law Date: Wed, 1 Oct 1997 07:43:22 +0000 Subject: * libU77/sys_clock_.c: File renamed from system_clock_.c. libU77/Makefile.in, Makefile.in : Reference sys_clock_.*, not system_clock_.*. * libU77/dtime_.c (clk_tck): Try also HZ macro. * libU77/access.c (G77_access_0): Check malloc return value against 0, not NULL. libU77/getlog_.c, libU77/ttynam_.c, libU77/chdir_.c: Ditto. libU77/chmod_.c, libU77/rename_.c: Ditto. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@15821 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/f/runtime/ChangeLog.egcs | 11 ++++++ gcc/f/runtime/Makefile.in | 2 +- gcc/f/runtime/libU77/Makefile.in | 6 ++-- gcc/f/runtime/libU77/access_.c | 4 +-- gcc/f/runtime/libU77/chdir_.c | 2 +- gcc/f/runtime/libU77/chmod_.c | 4 +-- gcc/f/runtime/libU77/dtime_.c | 4 +++ gcc/f/runtime/libU77/etime_.c | 2 ++ gcc/f/runtime/libU77/getlog_.c | 1 + gcc/f/runtime/libU77/rename_.c | 3 ++ gcc/f/runtime/libU77/sys_clock_.c | 66 ++++++++++++++++++++++++++++++++++++ gcc/f/runtime/libU77/system_clock_.c | 64 ---------------------------------- gcc/f/runtime/libU77/ttynam_.c | 1 + 13 files changed, 97 insertions(+), 73 deletions(-) create mode 100644 gcc/f/runtime/libU77/sys_clock_.c delete mode 100644 gcc/f/runtime/libU77/system_clock_.c diff --git a/gcc/f/runtime/ChangeLog.egcs b/gcc/f/runtime/ChangeLog.egcs index 0627d937acf..5523b1e19a9 100644 --- a/gcc/f/runtime/ChangeLog.egcs +++ b/gcc/f/runtime/ChangeLog.egcs @@ -1,3 +1,14 @@ +Wed Oct 1 01:46:16 1997 Philippe De Muyter + + * libU77/sys_clock_.c: File renamed from system_clock_.c. + libU77/Makefile.in, Makefile.in : Reference sys_clock_.*, not + system_clock_.*. + * libU77/dtime_.c (clk_tck): Try also HZ macro. + * libU77/access.c (G77_access_0): Check malloc return value against 0, + not NULL. + libU77/getlog_.c, libU77/ttynam_.c, libU77/chdir_.c: Ditto. + libU77/chmod_.c, libU77/rename_.c: Ditto. + 1997-09-19 Dave Love * libU77/dtime_.c (G77_dtime_0): Fix types in HAVE_GETRUSAGE case diff --git a/gcc/f/runtime/Makefile.in b/gcc/f/runtime/Makefile.in index 5e019e55f5b..53275b918e3 100644 --- a/gcc/f/runtime/Makefile.in +++ b/gcc/f/runtime/Makefile.in @@ -131,7 +131,7 @@ UOBJ = libU77/VersionU.o libU77/gerror_.o libU77/perror_.o libU77/ierrno_.o \ libU77/vxtidate_.o libU77/gmtime_.o libU77/fdate_.o libU77/secnds_.o \ libU77/bes.o libU77/dbes.o libU77/chdir_.o libU77/chmod_.o \ libU77/lnblnk_.o libU77/hostnm_.o libU77/rename_.o libU77/fgetc_.o \ - libU77/fputc_.o libU77/umask_.o libU77/system_clock_.o libU77/date_.o \ + libU77/fputc_.o libU77/umask_.o libU77/sys_clock_.o libU77/date_.o \ libU77/second_.o libU77/flush1_.o libU77/alarm_.o libU77/mclock_.o \ libU77/symlnk_.o diff --git a/gcc/f/runtime/libU77/Makefile.in b/gcc/f/runtime/libU77/Makefile.in index 2e6846b23de..c307bedfa38 100644 --- a/gcc/f/runtime/libU77/Makefile.in +++ b/gcc/f/runtime/libU77/Makefile.in @@ -58,7 +58,7 @@ OBJS = VersionU.o gerror_.o perror_.o ierrno_.o itime_.o time_.o \ vxttime_.o vxtidate_.o gmtime_.o fdate_.o secnds_.o \ bes.o dbes.o \ chdir_.o chmod_.o lnblnk_.o hostnm_.o rename_.o fgetc_.o fputc_.o \ - umask_.o system_clock_.o date_.o second_.o flush1_.o mclock_.o \ + umask_.o sys_clock_.o date_.o second_.o flush1_.o mclock_.o \ alarm_.o SRCS = Version.c gerror_.c perror_.c ierrno_.c itime_.c time_.c \ unlink_.c fnum_.c getpid_.c getuid_.c getgid_.c kill_.c rand_.c \ @@ -68,7 +68,7 @@ SRCS = Version.c gerror_.c perror_.c ierrno_.c itime_.c time_.c \ vxttime_.c vxtidate_.c gmtime_.c fdate_.c secnds_.c \ bes.c dbes.c \ chdir_.c chmod_.c lnblnk_.c hostnm_.c rename_.c fgetc_.c fputc_.c \ - umask_.c system_clock_.c date_.c second_.c flush1_.c mclock_.c \ + umask_.c sys_clock_.c date_.c second_.c flush1_.c mclock_.c \ alarm_.c F2C_H = ../../../include/f2c.h @@ -146,7 +146,7 @@ hostnm_.o: hostnm_.c rename_.o: rename_.c fputc_.o: fputc_.c fgetc_.o: fgetc_.c -system_clock_.o: system_clock_.c +sys_clock_.o: sys_clock_.c umask_.o: umask_.c flush1_.o: flush1_.c mclock_.o: mclock_.c diff --git a/gcc/f/runtime/libU77/access_.c b/gcc/f/runtime/libU77/access_.c index 1699ef065f2..fefdebb0d8d 100644 --- a/gcc/f/runtime/libU77/access_.c +++ b/gcc/f/runtime/libU77/access_.c @@ -25,7 +25,7 @@ Boston, MA 02111-1307, USA. */ #if HAVE_STDLIB_H # include #else -# include /* for NULL */ +# include #endif #include @@ -62,7 +62,7 @@ integer G77_access_0 (const char *name, const char *mode, ftnlen Lname, ftnlen L int amode, i; buff = malloc (Lname+1); - if (buff == NULL) return -1; + if (!buff) return -1; g_char (name, Lname, buff); amode = 0; for (i=0;i #else -# include /* for NULL */ +# include #endif #include "f2c.h" @@ -62,7 +62,7 @@ integer G77_chmod_0 (/* const */ char *name, /* const */ char *mode, const ftnle char chmod_path [] = CHMOD_PATH; l = strlen (chmod_path); buff = malloc (Lname+Lmode+l+3+13+1); - if (buff == NULL) return -1; + if (!buff) return -1; ii[0] = l; a[0] = chmod_path; ii[1] = 1; a[1] = " "; ii[2] = Lmode; a[2] = mode; diff --git a/gcc/f/runtime/libU77/dtime_.c b/gcc/f/runtime/libU77/dtime_.c index 9569db3fae0..dfc3fde34cf 100644 --- a/gcc/f/runtime/libU77/dtime_.c +++ b/gcc/f/runtime/libU77/dtime_.c @@ -22,7 +22,9 @@ Boston, MA 02111-1307, USA. */ #if HAVE_UNISTD_H # include #endif +#include #include +#include #if HAVE_GETRUSAGE # include # include @@ -70,6 +72,8 @@ double G77_dtime_0 (real tarray[2]) if (! clk_tck) clk_tck = CLOCKS_PER_SECOND; # elif defined CLK_TCK if (! clk_tck) clk_tck = CLK_TCK; +# elif defined HZ + if (! clk_tck) clk_tck = HZ; # elif defined HAVE_GETRUSAGE # else #error Dont know clock tick length diff --git a/gcc/f/runtime/libU77/etime_.c b/gcc/f/runtime/libU77/etime_.c index fa6ccfb0d4d..625d3d06d2a 100644 --- a/gcc/f/runtime/libU77/etime_.c +++ b/gcc/f/runtime/libU77/etime_.c @@ -66,6 +66,8 @@ double G77_etime_0 (real tarray[2]) if (! clk_tck) clk_tck = CLOCKS_PER_SECOND; # elif defined CLK_TCK if (! clk_tck) clk_tck = CLK_TCK; +# elif defined HZ + if (! clk_tck) clk_tck = HZ; # elif defined HAVE_GETRUSAGE # else #error Dont know clock tick length diff --git a/gcc/f/runtime/libU77/getlog_.c b/gcc/f/runtime/libU77/getlog_.c index a2c5f20f28b..1c2f7db1ce1 100644 --- a/gcc/f/runtime/libU77/getlog_.c +++ b/gcc/f/runtime/libU77/getlog_.c @@ -19,6 +19,7 @@ Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif +#include #if HAVE_STDLIB_H # include #else diff --git a/gcc/f/runtime/libU77/rename_.c b/gcc/f/runtime/libU77/rename_.c index e8a4bf6523c..9583001c421 100644 --- a/gcc/f/runtime/libU77/rename_.c +++ b/gcc/f/runtime/libU77/rename_.c @@ -19,6 +19,9 @@ Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif +#if HAVE_UNISTD_H +# include +#endif #if HAVE_STDLIB_H # include #endif diff --git a/gcc/f/runtime/libU77/sys_clock_.c b/gcc/f/runtime/libU77/sys_clock_.c new file mode 100644 index 00000000000..5644d497906 --- /dev/null +++ b/gcc/f/runtime/libU77/sys_clock_.c @@ -0,0 +1,66 @@ +/* Copyright (C) 1996 Free Software Foundation, Inc. +This file is part of GNU Fortran libU77 library. + +This library is free software; you can redistribute it and/or modify it +under the terms of the GNU Library General Public License as published +by the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +GNU Fortran is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with GNU Fortran; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#if TIME_WITH_SYS_TIME +# include +# include +#else +# if HAVE_SYS_TIME_H +# include +# else +# include +# endif +#endif +#include +#include +#if HAVE_UNISTD_H +# include +#endif +#include "f2c.h" + +#ifdef KR_headers +int G77_system_clock_0 (count, count_rate, count_max) + integer *count, *count_rate, *count_max; +#else +int G77_system_clock_0 (integer *count, integer *count_rate, integer *count_max) +#endif +{ + struct tms buffer; + unsigned long cnt; +#ifdef _SC_CLK_TCK + *count_rate = sysconf(_SC_CLK_TCK); +#elif defined CLOCKS_PER_SECOND + *count_rate = CLOCKS_PER_SECOND; +#elif defined CLK_TCK + *count_rate = CLK_TCK; +#elif defined HZ + *count_rate = HZ; +#else + #error Dont know clock tick length +#endif + *count_max = INT_MAX; /* dubious */ + cnt = times (&buffer); + if (cnt > (unsigned long) (*count_max)) + *count = *count_max; /* also dubious */ + else + *count = cnt; + return 0; +} diff --git a/gcc/f/runtime/libU77/system_clock_.c b/gcc/f/runtime/libU77/system_clock_.c deleted file mode 100644 index d5cbaac0608..00000000000 --- a/gcc/f/runtime/libU77/system_clock_.c +++ /dev/null @@ -1,64 +0,0 @@ -/* Copyright (C) 1996 Free Software Foundation, Inc. -This file is part of GNU Fortran libU77 library. - -This library is free software; you can redistribute it and/or modify it -under the terms of the GNU Library General Public License as published -by the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -GNU Fortran is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with GNU Fortran; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#if TIME_WITH_SYS_TIME -# include -# include -#else -# if HAVE_SYS_TIME_H -# include -# else -# include -# endif -#endif -#include -#include -#if HAVE_UNISTD_H -# include -#endif -#include "f2c.h" - -#ifdef KR_headers -int G77_system_clock_0 (count, count_rate, count_max) - integer *count, *count_rate, *count_max; -#else -int G77_system_clock_0 (integer *count, integer *count_rate, integer *count_max) -#endif -{ - struct tms buffer; - unsigned long cnt; -#ifdef _SC_CLK_TCK - *count_rate = sysconf(_SC_CLK_TCK); -#elif defined CLOCKS_PER_SECOND - *count_rate = CLOCKS_PER_SECOND; -#elif defined CLK_TCK - *count_rate = CLK_TCK; -#else - #error Dont know clock tick length -#endif - *count_max = INT_MAX; /* dubious */ - cnt = times (&buffer); - if (cnt > (unsigned long) (*count_max)) - *count = *count_max; /* also dubious */ - else - *count = cnt; - return 0; -} diff --git a/gcc/f/runtime/libU77/ttynam_.c b/gcc/f/runtime/libU77/ttynam_.c index f69aa43f564..12b50191fe3 100644 --- a/gcc/f/runtime/libU77/ttynam_.c +++ b/gcc/f/runtime/libU77/ttynam_.c @@ -19,6 +19,7 @@ Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif +#include #if STDC_HEADERS # include #endif -- cgit v1.2.3