applied patch from Andreas Persenius <ndap@swipnet.se> that updates the
[platform/upstream/glib.git] / gdate.c
diff --git a/gdate.c b/gdate.c
index 44a6bad..d287fb4 100644 (file)
--- a/gdate.c
+++ b/gdate.c
@@ -2,25 +2,37 @@
  * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
  *
  * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
+ * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2 of the License, or (at your option) any later version.
  *
  * This library 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.
+ * Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU Library General Public
+ * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the
  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  * Boston, MA 02111-1307, USA.
  */
 
+/*
+ * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
+ * file for a list of people on the GLib Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/. 
+ */
+
 /* 
  * MT safe
  */
 
+#define DEBUG_MSG(x)   /* */
+#ifdef G_ENABLE_DEBUG
+/* #define DEBUG_MSG(args)     g_message args ; */
+#endif
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
@@ -392,7 +404,7 @@ g_date_clear (GDate       *d, guint ndates)
   memset (d, 0x0, ndates*sizeof (GDate)); 
 }
 
-G_LOCK_DECLARE_STATIC (g_date_global);
+G_LOCK_DEFINE_STATIC (g_date_global);
 
 /* These are for the parser, output to the user should use *
  * g_date_strftime () - this creates more never-freed memory to annoy
@@ -446,7 +458,7 @@ g_date_fill_parse_tokens (const gchar *str, GDateParseTokens *pt)
 {
   gchar num[4][NUM_LEN+1];
   gint i;
-  const gchar *s;
+  const guchar *s;
   
   /* We count 4, but store 3; so we can give an error
    * if there are 4.
@@ -602,17 +614,15 @@ g_date_prepare_to_parse (const gchar *str, GDateParseTokens *pt)
         }
       
 #ifdef G_ENABLE_DEBUG
-      g_message ("**GDate prepared a new set of locale-specific parse rules.");
+      DEBUG_MSG (("**GDate prepared a new set of locale-specific parse rules."));
       i = 1;
       while (i < 13) 
         {
-          g_message ("  %s   %s", long_month_names[i], short_month_names[i]);
+          DEBUG_MSG (("  %s   %s", long_month_names[i], short_month_names[i]));
           ++i;
         }
       if (using_twodigit_years)
-        {
-          g_message ("**Using twodigit years with cutoff year: %u", twodigit_start_year);
-        }
+       DEBUG_MSG (("**Using twodigit years with cutoff year: %u", twodigit_start_year));
       { 
         gchar *strings[3];
         i = 0;
@@ -635,8 +645,8 @@ g_date_prepare_to_parse (const gchar *str, GDateParseTokens *pt)
               }
             ++i;
           }
-        g_message ("**Order: %s, %s, %s", strings[0], strings[1], strings[2]);
-        g_message ("**Sample date in this locale: `%s'", buf);
+        DEBUG_MSG (("**Order: %s, %s, %s", strings[0], strings[1], strings[2]));
+        DEBUG_MSG (("**Sample date in this locale: `%s'", buf));
       }
 #endif
     }
@@ -660,10 +670,8 @@ g_date_set_parse (GDate       *d,
 
   g_date_prepare_to_parse (str, &pt);
   
-#ifdef G_ENABLE_DEBUG
-  g_message ("Found %d ints, `%d' `%d' `%d' and written out month %d", 
-            pt.num_ints, pt.n[0], pt.n[1], pt.n[2], pt.month);
-#endif
+  DEBUG_MSG (("Found %d ints, `%d' `%d' `%d' and written out month %d", 
+             pt.num_ints, pt.n[0], pt.n[1], pt.n[2], pt.month));
   
   
   if (pt.num_ints == 4) 
@@ -784,7 +792,7 @@ g_date_set_parse (GDate       *d,
     }
 #ifdef G_ENABLE_DEBUG
   else 
-    g_message ("Rejected DMY %u %u %u", day, m, y);
+    DEBUG_MSG (("Rejected DMY %u %u %u", day, m, y));
 #endif
   G_UNLOCK (g_date_global);
 }
@@ -801,10 +809,6 @@ g_date_set_time (GDate *d,
 #ifdef HAVE_LOCALTIME_R
   localtime_r (&t, &tm);
 #else
-#  ifdef G_THREADS_ENABLED
-#  warning "the `g_date_set_time' function will not be MT-safe"
-#  warning "because there is no `localtime_r' on your system."
-#  endif
   {
     struct tm *ptm = localtime (&t);
     g_assert (ptm);