changeset 10239:e45ccac6017f

addtional fixes for using strptime module
author John W. Eaton <jwe@octave.org>
date Tue, 02 Feb 2010 00:51:52 -0500
parents 144739908eef
children fa7b5751730c
files ChangeLog acinclude.m4 configure.ac liboctave/ChangeLog liboctave/lo-cutils.c liboctave/lo-utils.h liboctave/oct-time.cc
diffstat 7 files changed, 11 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Feb 01 20:19:54 2010 +0100
+++ b/ChangeLog	Tue Feb 02 00:51:52 2010 -0500
@@ -1,3 +1,8 @@
+2010-02-02  John W. Eaton  <jwe@octave.org>
+
+	* acinclue.m4 (OCTAVE_STRPTIME_BROKEN): Delete.
+	* configure.ac: Don't call it.
+
 2010-02-01  John W. Eaton  <jwe@octave.org>
 
 	* acinclude.m4 (OCTAVE_PROG_MAKEINFO): Delete macro.
--- a/acinclude.m4	Mon Feb 01 20:19:54 2010 +0100
+++ b/acinclude.m4	Tue Feb 02 00:51:52 2010 -0500
@@ -106,33 +106,6 @@
 AC_LANG_POP(C++)
 ])
 dnl
-dnl Check for broken strptime
-dnl
-AC_DEFUN([OCTAVE_STRPTIME_BROKEN],
-[AC_CACHE_CHECK([whether strptime is broken],
-octave_cv_strptime_broken,
-[AC_LANG_PUSH(C)
-AC_RUN_IFELSE([AC_LANG_PROGRAM([[
-#define _XOPEN_SOURCE
-#if defined (HAVE_SYS_TYPES_H)
-#include <sys/types.h>
-#if defined (HAVE_UNISTD_H)
-#include <unistd.h>
-#endif
-#endif
-#include <stdio.h>
-#include <time.h>
-]], [[
-struct tm t;
-char *q = strptime ("09/13", "%m/%d/%y", &t);
-return q ? 1 : 0;
-]])], [octave_cv_strptime_broken=no], [octave_cv_strptime_broken=yes])])
-if test $octave_cv_strptime_broken = yes; then
-AC_DEFINE(OCTAVE_HAVE_BROKEN_STRPTIME, 1, [Define if strptime is broken on your system])
-fi
-AC_LANG_POP(C)
-])
-dnl
 dnl The following test is from Karl Berry's Kpathseach library.  I'm
 dnl including it here in case we someday want to make the use of
 dnl kpathsea optional.
--- a/configure.ac	Mon Feb 01 20:19:54 2010 +0100
+++ b/configure.ac	Tue Feb 02 00:51:52 2010 -0500
@@ -1554,7 +1554,6 @@
 esac
 
 OCTAVE_HAVE_C99_VSNPRINTF
-OCTAVE_STRPTIME_BROKEN
 OCTAVE_SMART_PUTENV
 
 case "$canonical_host_type" in
--- a/liboctave/ChangeLog	Mon Feb 01 20:19:54 2010 +0100
+++ b/liboctave/ChangeLog	Tue Feb 02 00:51:52 2010 -0500
@@ -1,3 +1,8 @@
+2010-02-02  John W. Eaton  <jwe@octave.org>
+
+	* lo-utils.h, lo-cutils.c (oct_strptime): Delete.
+	* oct-time.cc (octave_strptime::init): Call strptime, not oct_strptime.
+
 2010-01-28  Jaroslav Hajek  <highegg@gmail.com>
 
 	* dMatrix.cc (Matrix::determinant): Treat matrices marked as singular
--- a/liboctave/lo-cutils.c	Mon Feb 01 20:19:54 2010 +0100
+++ b/liboctave/lo-cutils.c	Tue Feb 02 00:51:52 2010 -0500
@@ -55,12 +55,6 @@
   qsort (base, n, size, cmp);
 }
 
-OCTAVE_API char *
-oct_strptime (const char *buf, const char *format, struct tm *tm)
-{
-  return (char *) strptime (buf, format, tm);
-}
-
 #if defined (__WIN32__) && ! defined (_POSIX_VERSION)
 
 #include <winsock.h>
--- a/liboctave/lo-utils.h	Mon Feb 01 20:19:54 2010 +0100
+++ b/liboctave/lo-utils.h	Tue Feb 02 00:51:52 2010 -0500
@@ -56,9 +56,6 @@
 octave_qsort (void *base, size_t n, size_t size,
               int (*cmp) (const void *, const void *));
 
-extern "C" OCTAVE_API char *
-oct_strptime (const char *buf, const char *format, struct tm *tm);
-
 extern "C" OCTAVE_API int
 octave_strcasecmp (const char *s1, const char *s2);
 
--- a/liboctave/oct-time.cc	Mon Feb 01 20:19:54 2010 +0100
+++ b/liboctave/oct-time.cc	Tue Feb 02 00:51:52 2010 -0500
@@ -272,7 +272,7 @@
 
   char *p = strsave (str.c_str ());
 
-  char *q = oct_strptime (p, fmt.c_str (), &t);
+  char *q = strptime (p, fmt.c_str (), &t);
 
   // Fill in wday and yday, but only if mday is valid and the mon and year
   // are filled in, avoiding issues with mktime and invalid dates.