Add checks for vasprintf, localtime_r.
authorJeff Garzik <jgarzik@src.gnome.org>
Sat, 9 Jan 1999 19:14:16 +0000 (19:14 +0000)
committerJeff Garzik <jgarzik@src.gnome.org>
Sat, 9 Jan 1999 19:14:16 +0000 (19:14 +0000)
        * configure.in:
        Add checks for vasprintf, localtime_r.

        * gdate.c (g_date_set_time):
        Use localtime if localtime_r is not available.

        * gstrfuncs.c (g_strdup_vprintf):
        Use glibc vasprintf if possible; it's a bit faster than using
        GLib routines, and makes output code a bit smaller.

        * acconfig.h:
        Remove HAVE_VSNPRINTF and HAVE_VPRINTF.  autoheader picks these
        up automatically and puts them in config.h.in.

14 files changed:
ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-12
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
acconfig.h
configure.in
gdate.c
glib/gdate.c
glib/gstrfuncs.c
gstrfuncs.c

index 1586695..2e97a6f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+Sat Jan  9 13:53:00 1999  Jeff Garzik  <jgarzik@pobox.com>
+
+       * configure.in:
+       Add checks for vasprintf, localtime_r.
+
+       * gdate.c (g_date_set_time):
+       Use localtime if localtime_r is not available.
+
+       * gstrfuncs.c (g_strdup_vprintf):
+       Use glibc vasprintf if possible; it's a bit faster than using
+       GLib routines, and makes output code a bit smaller.
+
+       * acconfig.h:
+       Remove HAVE_VSNPRINTF and HAVE_VPRINTF.  autoheader picks these
+       up automatically and puts them in config.h.in.
+
 Thu Jan  7 15:14:08 1999  Owen Taylor  <otaylor@redhat.com>
 
        * gmain.c (g_source_free_func): Call the source-specific
index 1586695..2e97a6f 100644 (file)
@@ -1,3 +1,19 @@
+Sat Jan  9 13:53:00 1999  Jeff Garzik  <jgarzik@pobox.com>
+
+       * configure.in:
+       Add checks for vasprintf, localtime_r.
+
+       * gdate.c (g_date_set_time):
+       Use localtime if localtime_r is not available.
+
+       * gstrfuncs.c (g_strdup_vprintf):
+       Use glibc vasprintf if possible; it's a bit faster than using
+       GLib routines, and makes output code a bit smaller.
+
+       * acconfig.h:
+       Remove HAVE_VSNPRINTF and HAVE_VPRINTF.  autoheader picks these
+       up automatically and puts them in config.h.in.
+
 Thu Jan  7 15:14:08 1999  Owen Taylor  <otaylor@redhat.com>
 
        * gmain.c (g_source_free_func): Call the source-specific
index 1586695..2e97a6f 100644 (file)
@@ -1,3 +1,19 @@
+Sat Jan  9 13:53:00 1999  Jeff Garzik  <jgarzik@pobox.com>
+
+       * configure.in:
+       Add checks for vasprintf, localtime_r.
+
+       * gdate.c (g_date_set_time):
+       Use localtime if localtime_r is not available.
+
+       * gstrfuncs.c (g_strdup_vprintf):
+       Use glibc vasprintf if possible; it's a bit faster than using
+       GLib routines, and makes output code a bit smaller.
+
+       * acconfig.h:
+       Remove HAVE_VSNPRINTF and HAVE_VPRINTF.  autoheader picks these
+       up automatically and puts them in config.h.in.
+
 Thu Jan  7 15:14:08 1999  Owen Taylor  <otaylor@redhat.com>
 
        * gmain.c (g_source_free_func): Call the source-specific
index 1586695..2e97a6f 100644 (file)
@@ -1,3 +1,19 @@
+Sat Jan  9 13:53:00 1999  Jeff Garzik  <jgarzik@pobox.com>
+
+       * configure.in:
+       Add checks for vasprintf, localtime_r.
+
+       * gdate.c (g_date_set_time):
+       Use localtime if localtime_r is not available.
+
+       * gstrfuncs.c (g_strdup_vprintf):
+       Use glibc vasprintf if possible; it's a bit faster than using
+       GLib routines, and makes output code a bit smaller.
+
+       * acconfig.h:
+       Remove HAVE_VSNPRINTF and HAVE_VPRINTF.  autoheader picks these
+       up automatically and puts them in config.h.in.
+
 Thu Jan  7 15:14:08 1999  Owen Taylor  <otaylor@redhat.com>
 
        * gmain.c (g_source_free_func): Call the source-specific
index 1586695..2e97a6f 100644 (file)
@@ -1,3 +1,19 @@
+Sat Jan  9 13:53:00 1999  Jeff Garzik  <jgarzik@pobox.com>
+
+       * configure.in:
+       Add checks for vasprintf, localtime_r.
+
+       * gdate.c (g_date_set_time):
+       Use localtime if localtime_r is not available.
+
+       * gstrfuncs.c (g_strdup_vprintf):
+       Use glibc vasprintf if possible; it's a bit faster than using
+       GLib routines, and makes output code a bit smaller.
+
+       * acconfig.h:
+       Remove HAVE_VSNPRINTF and HAVE_VPRINTF.  autoheader picks these
+       up automatically and puts them in config.h.in.
+
 Thu Jan  7 15:14:08 1999  Owen Taylor  <otaylor@redhat.com>
 
        * gmain.c (g_source_free_func): Call the source-specific
index 1586695..2e97a6f 100644 (file)
@@ -1,3 +1,19 @@
+Sat Jan  9 13:53:00 1999  Jeff Garzik  <jgarzik@pobox.com>
+
+       * configure.in:
+       Add checks for vasprintf, localtime_r.
+
+       * gdate.c (g_date_set_time):
+       Use localtime if localtime_r is not available.
+
+       * gstrfuncs.c (g_strdup_vprintf):
+       Use glibc vasprintf if possible; it's a bit faster than using
+       GLib routines, and makes output code a bit smaller.
+
+       * acconfig.h:
+       Remove HAVE_VSNPRINTF and HAVE_VPRINTF.  autoheader picks these
+       up automatically and puts them in config.h.in.
+
 Thu Jan  7 15:14:08 1999  Owen Taylor  <otaylor@redhat.com>
 
        * gmain.c (g_source_free_func): Call the source-specific
index 1586695..2e97a6f 100644 (file)
@@ -1,3 +1,19 @@
+Sat Jan  9 13:53:00 1999  Jeff Garzik  <jgarzik@pobox.com>
+
+       * configure.in:
+       Add checks for vasprintf, localtime_r.
+
+       * gdate.c (g_date_set_time):
+       Use localtime if localtime_r is not available.
+
+       * gstrfuncs.c (g_strdup_vprintf):
+       Use glibc vasprintf if possible; it's a bit faster than using
+       GLib routines, and makes output code a bit smaller.
+
+       * acconfig.h:
+       Remove HAVE_VSNPRINTF and HAVE_VPRINTF.  autoheader picks these
+       up automatically and puts them in config.h.in.
+
 Thu Jan  7 15:14:08 1999  Owen Taylor  <otaylor@redhat.com>
 
        * gmain.c (g_source_free_func): Call the source-specific
index 1586695..2e97a6f 100644 (file)
@@ -1,3 +1,19 @@
+Sat Jan  9 13:53:00 1999  Jeff Garzik  <jgarzik@pobox.com>
+
+       * configure.in:
+       Add checks for vasprintf, localtime_r.
+
+       * gdate.c (g_date_set_time):
+       Use localtime if localtime_r is not available.
+
+       * gstrfuncs.c (g_strdup_vprintf):
+       Use glibc vasprintf if possible; it's a bit faster than using
+       GLib routines, and makes output code a bit smaller.
+
+       * acconfig.h:
+       Remove HAVE_VSNPRINTF and HAVE_VPRINTF.  autoheader picks these
+       up automatically and puts them in config.h.in.
+
 Thu Jan  7 15:14:08 1999  Owen Taylor  <otaylor@redhat.com>
 
        * gmain.c (g_source_free_func): Call the source-specific
index 48582cd..ae08a75 100644 (file)
@@ -58,9 +58,7 @@
 #undef HAVE_STRERROR
 #undef HAVE_STRSIGNAL
 #undef HAVE_UNISTD_H
-#undef HAVE_VSNPRINTF
 #undef HAVE_VALUES_H
-#undef HAVE_VPRINTF
 #undef HAVE_WCHAR_H
 #undef HAVE_WCTYPE_H
 
index b6b0ba1..67c3adc 100644 (file)
@@ -254,7 +254,7 @@ AC_CHECK_HEADERS(values.h, AC_DEFINE(HAVE_VALUES_H))
 AC_CHECK_HEADER(alloca.h, glib_have_alloca_h=yes, glib_have_alloca_h=no)
 
 # Check for some functions
-AC_CHECK_FUNCS(lstat strerror strsignal memmove vsnprintf strcasecmp strncasecmp poll)
+AC_CHECK_FUNCS(localtime_r lstat strerror strsignal memmove vsnprintf vasprintf strcasecmp strncasecmp poll)
 
 # Check for sys_errlist
 AC_MSG_CHECKING(for sys_errlist)
diff --git a/gdate.c b/gdate.c
index 08b3b0b..04d0a9a 100644 (file)
--- a/gdate.c
+++ b/gdate.c
@@ -790,11 +790,16 @@ g_date_set_time (GDate *d,
                 GTime  time)
 {
   time_t t = time;
-  struct tm tm;
+  struct tm tm, *ptm;
   
   g_return_if_fail (d != NULL);
   
+#if HAVE_LOCALTIME_R
   localtime_r (&t, &tm);
+#else
+  ptm = localtime (&t);
+  memcpy((void *) &tm, (void *) ptm, sizeof(struct tm));
+#endif
   
   d->julian = FALSE;
   
index 08b3b0b..04d0a9a 100644 (file)
@@ -790,11 +790,16 @@ g_date_set_time (GDate *d,
                 GTime  time)
 {
   time_t t = time;
-  struct tm tm;
+  struct tm tm, *ptm;
   
   g_return_if_fail (d != NULL);
   
+#if HAVE_LOCALTIME_R
   localtime_r (&t, &tm);
+#else
+  ptm = localtime (&t);
+  memcpy((void *) &tm, (void *) ptm, sizeof(struct tm));
+#endif
   
   d->julian = FALSE;
   
index e154c56..6e58ad5 100644 (file)
@@ -108,6 +108,15 @@ g_strdup_vprintf (const gchar *format,
                  va_list      args1)
 {
   gchar *buffer;
+
+#if (HAVE_VASPRINTF) && !(ENABLE_MEM_CHECK)
+  /* if memory checking is disabled, that means we can call g_free() on
+   * memory obtained via malloc().  This allows us to use the
+   * glibc vasprintf() call where available.
+   */
+  vasprintf (&buffer, format, args1);
+#else
+
   va_list args2;
 
   G_VA_COPY (args2, args1);
@@ -117,6 +126,8 @@ g_strdup_vprintf (const gchar *format,
   vsprintf (buffer, format, args2);
   va_end (args2);
 
+#endif /* (HAVE_VASPRINTF) && !(ENABLE_MEM_CHECK) */
+
   return buffer;
 }
 
index e154c56..6e58ad5 100644 (file)
@@ -108,6 +108,15 @@ g_strdup_vprintf (const gchar *format,
                  va_list      args1)
 {
   gchar *buffer;
+
+#if (HAVE_VASPRINTF) && !(ENABLE_MEM_CHECK)
+  /* if memory checking is disabled, that means we can call g_free() on
+   * memory obtained via malloc().  This allows us to use the
+   * glibc vasprintf() call where available.
+   */
+  vasprintf (&buffer, format, args1);
+#else
+
   va_list args2;
 
   G_VA_COPY (args2, args1);
@@ -117,6 +126,8 @@ g_strdup_vprintf (const gchar *format,
   vsprintf (buffer, format, args2);
   va_end (args2);
 
+#endif /* (HAVE_VASPRINTF) && !(ENABLE_MEM_CHECK) */
+
   return buffer;
 }