always-wrap-vos-ctime-20080718
authorRuss Allbery <rra@stanford.edu>
Sat, 19 Jul 2008 07:41:06 +0000 (07:41 +0000)
committerRuss Allbery <rra@stanford.edu>
Sat, 19 Jul 2008 07:41:06 +0000 (07:41 +0000)
LICENSE MIT

When calling ctime on an afs_int32, always use a wrapper that assigns the
variable to a time_t before passing it in rather than conditionally doing
so on hosts with a large time_t.  This eliminates a configure test,
removes a bunch of warnings in vos.c on platforms with 32-bit time_t, and
will make no difference in generated code with any decent compiler.

acconfig.h
acinclude.m4
src/volser/vos.c

index 948ce06..ab3fe15 100644 (file)
@@ -70,7 +70,6 @@ static /**/const char *const rcsid[] = { (char *)rcsid, "\100(#)" msg }
 #undef STRUCT_TASK_STRUCT_HAS_SIGHAND
 #undef STRUCT_TASK_STRUCT_HAS_SIGMASK_LOCK
 #undef ssize_t
-#undef SIZEOF_TIME_T
 #undef HAVE_STRUCT_BUF
 #undef HAVE_ARPA_NAMESER_COMPAT_H
 /* glue for RedHat kernel bug */
index 89b00b8..6396257 100644 (file)
@@ -1413,21 +1413,6 @@ AC_CHECK_TYPE([sig_atomic_t], ,
 #include <signal.h>])
 AC_SIZEOF_TYPE(long)
 
-AC_MSG_CHECKING(size of time_t)
-AC_CACHE_VAL(ac_cv_sizeof_time_t,
-[AC_TRY_RUN([#include <stdio.h>
-#include <time.h>
-main()
-{
-  FILE *f=fopen("conftestval", "w");
-  if (!f) exit(1);
-  fprintf(f, "%d\n", sizeof(time_t));
-  exit(0);
-}], ac_cv_sizeof_time_t=`cat conftestval`, ac_cv_sizeof_time_t=0)
-])
-AC_MSG_RESULT($ac_cv_sizeof_time_t)
-AC_DEFINE_UNQUOTED(SIZEOF_TIME_T, $ac_cv_sizeof_time_t)
-
 AC_CHECK_FUNCS(timegm)
 AC_CHECK_FUNCS(daemon)
 
index 84e7720..30fbc83 100644 (file)
@@ -472,16 +472,12 @@ DumpFunction(struct rx_call *call, char *filename)
     return (error);
 }
 
-#if SIZEOF_TIME_T!=4
 static char *
 vos_ctime(afs_int32 *timep)
 {
     time_t foo = *timep;
     return ctime(&foo);
 }
-#else
-#define vos_ctime ctime
-#endif
 
 static void
 DisplayFormat(pntr, server, part, totalOK, totalNotOK, totalBusy, fast,