From 9f44e3155d3910a7a6ffe19cd79667d65940543e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=B6hler?= Date: Sat, 5 May 2007 21:02:56 +0000 Subject: [PATCH] Do not use langinfo to determine date format spec, but %x, %X or %c. Remove check for HAVE_LANGINFO_D_FMT. Rather use standard strftime and (standard?) strptime format specifiers %x (date), %X (time) and %c (date&time, all in national representation). git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@16049 57a11ea4-9604-0410-9ed3-97b8803252fd --- configure.in | 3 --- lib/libqof/qof/gnc-date.c | 20 +++----------------- macros/legacy_macros.m4 | 14 -------------- src/engine/FreqSpec.c | 17 ++--------------- src/gnome/dialog-sx-editor.c | 4 ---- 5 files changed, 5 insertions(+), 53 deletions(-) diff --git a/configure.in b/configure.in index fa0f73aa3c..35c98e5e3d 100644 --- a/configure.in +++ b/configure.in @@ -876,9 +876,6 @@ if test "x$DATADIRNAME" = "x"; then AC_SUBST(DATADIRNAME) fi -dnl check for nl_langinfo(D_FMT) which is missing on FreeBSD -LANGINFO_D_FMT_CHECK - dnl Enable locale-specific tax-related information in the accounts AC_ARG_ENABLE( locale-specific-tax, [ --enable-locale-specific-tax enable localized tax categories (experimental)], diff --git a/lib/libqof/qof/gnc-date.c b/lib/libqof/qof/gnc-date.c index b49ce2b173..c737b78975 100644 --- a/lib/libqof/qof/gnc-date.c +++ b/lib/libqof/qof/gnc-date.c @@ -31,14 +31,6 @@ /* to be renamed qofdate.c */ #include -#ifdef HAVE_LANGINFO_H -#define HAVE_LANGINFO_D_FMT 1 -#endif - -#ifdef HAVE_LANGINFO_D_FMT -#include -#endif - #include #include #include @@ -58,15 +50,9 @@ #define NANOS_PER_SECOND 1000000000 -#ifdef HAVE_LANGINFO_D_FMT -# define GNC_D_FMT (nl_langinfo (D_FMT)) -# define GNC_D_T_FMT (nl_langinfo (D_T_FMT)) -# define GNC_T_FMT (nl_langinfo (T_FMT)) -#else -# define GNC_D_FMT "%Y-%m-%d" -# define GNC_D_T_FMT "%Y-%m-%d %r" -# define GNC_T_FMT "%r" -#endif +#define GNC_D_FMT "%x" +#define GNC_D_T_FMT "%c" +#define GNC_T_FMT "%X" /* This is now user configured through the gnome options system() */ diff --git a/macros/legacy_macros.m4 b/macros/legacy_macros.m4 index 2ca4e773e4..ecf509f47a 100644 --- a/macros/legacy_macros.m4 +++ b/macros/legacy_macros.m4 @@ -220,17 +220,3 @@ int main () [Define if scanf supports %I64d conversions.]) fi ]) - -AC_DEFUN([LANGINFO_D_FMT_CHECK], -[ - AC_CACHE_CHECK([for nl_langinfo and D_FMT], am_cv_langinfo_dfmt, - [AC_TRY_LINK([#include ], - [char* cs = nl_langinfo(D_FMT);], - am_cv_langinfo_dfmt=yes, - am_cv_langinfo_dfmt=no) - ]) - if test $am_cv_langinfo_dfmt = yes; then - AC_DEFINE(HAVE_LANGINFO_D_FMT, 1, - [Define if you have and nl_langinfo(D_FMT).]) - fi -]) diff --git a/src/engine/FreqSpec.c b/src/engine/FreqSpec.c index cd2ef43d65..2a1f05952d 100644 --- a/src/engine/FreqSpec.c +++ b/src/engine/FreqSpec.c @@ -81,23 +81,10 @@ #include #include -#ifdef HAVE_LANGINFO_D_FMT -#include -#endif - #include "FreqSpecP.h" #undef G_LOG_DOMAIN #define G_LOG_DOMAIN "gnc.engine.freqspec" - -/* - * FIXME: should be in a header file - */ -#ifdef HAVE_LANGINFO_D_FMT -# define GNC_D_FMT (nl_langinfo (D_FMT)) -#else -# define GNC_D_FMT "%Y-%m-%d" -#endif #define GDATE_STRING_SIZE 25 #define GDATE_STRING_BUF_SIZE (GDATE_STRING_SIZE + 1) @@ -745,8 +732,8 @@ xaccFreqSpecGetFreqStr( FreqSpec *fs, GString *str ) tmpStr = g_new0( char, GDATE_STRING_BUF_SIZE ); /* this is now a GDate. */ g_date_strftime( tmpStr, GDATE_STRING_SIZE, - GNC_D_FMT, - &fs->s.once.date ); + "%x", + &fs->s.once.date ); /* %s is the strftime-string of the one-time date. */ snprintf( freqStrBuf, MAX_FREQ_STR_SIZE, _("Once: %s"), tmpStr ); g_free( tmpStr ); diff --git a/src/gnome/dialog-sx-editor.c b/src/gnome/dialog-sx-editor.c index c2d657730d..72fc6741b1 100644 --- a/src/gnome/dialog-sx-editor.c +++ b/src/gnome/dialog-sx-editor.c @@ -60,10 +60,6 @@ #include "gnc-sx-instance-model.h" #include "dialog-sx-since-last-run.h" -#ifdef HAVE_LANGINFO_D_FMT -#include -#endif - #undef G_LOG_DOMAIN #define G_LOG_DOMAIN "gnc.gui.sx.editor"