Add checks for vasprintf, localtime_r.

* 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.
This commit is contained in:
Jeff Garzik 1999-01-09 19:14:16 +00:00
parent dc60286631
commit 2a6789be13
14 changed files with 163 additions and 5 deletions

View 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> Thu Jan 7 15:14:08 1999 Owen Taylor <otaylor@redhat.com>
* gmain.c (g_source_free_func): Call the source-specific * gmain.c (g_source_free_func): Call the source-specific

View 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> Thu Jan 7 15:14:08 1999 Owen Taylor <otaylor@redhat.com>
* gmain.c (g_source_free_func): Call the source-specific * gmain.c (g_source_free_func): Call the source-specific

View 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> Thu Jan 7 15:14:08 1999 Owen Taylor <otaylor@redhat.com>
* gmain.c (g_source_free_func): Call the source-specific * gmain.c (g_source_free_func): Call the source-specific

View 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> Thu Jan 7 15:14:08 1999 Owen Taylor <otaylor@redhat.com>
* gmain.c (g_source_free_func): Call the source-specific * gmain.c (g_source_free_func): Call the source-specific

View 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> Thu Jan 7 15:14:08 1999 Owen Taylor <otaylor@redhat.com>
* gmain.c (g_source_free_func): Call the source-specific * gmain.c (g_source_free_func): Call the source-specific

View 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> Thu Jan 7 15:14:08 1999 Owen Taylor <otaylor@redhat.com>
* gmain.c (g_source_free_func): Call the source-specific * gmain.c (g_source_free_func): Call the source-specific

View 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> Thu Jan 7 15:14:08 1999 Owen Taylor <otaylor@redhat.com>
* gmain.c (g_source_free_func): Call the source-specific * gmain.c (g_source_free_func): Call the source-specific

View 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> Thu Jan 7 15:14:08 1999 Owen Taylor <otaylor@redhat.com>
* gmain.c (g_source_free_func): Call the source-specific * gmain.c (g_source_free_func): Call the source-specific

View File

@ -58,9 +58,7 @@
#undef HAVE_STRERROR #undef HAVE_STRERROR
#undef HAVE_STRSIGNAL #undef HAVE_STRSIGNAL
#undef HAVE_UNISTD_H #undef HAVE_UNISTD_H
#undef HAVE_VSNPRINTF
#undef HAVE_VALUES_H #undef HAVE_VALUES_H
#undef HAVE_VPRINTF
#undef HAVE_WCHAR_H #undef HAVE_WCHAR_H
#undef HAVE_WCTYPE_H #undef HAVE_WCTYPE_H

View 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) AC_CHECK_HEADER(alloca.h, glib_have_alloca_h=yes, glib_have_alloca_h=no)
# Check for some functions # 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 # Check for sys_errlist
AC_MSG_CHECKING(for sys_errlist) AC_MSG_CHECKING(for sys_errlist)

View File

@ -790,11 +790,16 @@ g_date_set_time (GDate *d,
GTime time) GTime time)
{ {
time_t t = time; time_t t = time;
struct tm tm; struct tm tm, *ptm;
g_return_if_fail (d != NULL); g_return_if_fail (d != NULL);
#if HAVE_LOCALTIME_R
localtime_r (&t, &tm); localtime_r (&t, &tm);
#else
ptm = localtime (&t);
memcpy((void *) &tm, (void *) ptm, sizeof(struct tm));
#endif
d->julian = FALSE; d->julian = FALSE;

View File

@ -790,11 +790,16 @@ g_date_set_time (GDate *d,
GTime time) GTime time)
{ {
time_t t = time; time_t t = time;
struct tm tm; struct tm tm, *ptm;
g_return_if_fail (d != NULL); g_return_if_fail (d != NULL);
#if HAVE_LOCALTIME_R
localtime_r (&t, &tm); localtime_r (&t, &tm);
#else
ptm = localtime (&t);
memcpy((void *) &tm, (void *) ptm, sizeof(struct tm));
#endif
d->julian = FALSE; d->julian = FALSE;

View File

@ -108,6 +108,15 @@ g_strdup_vprintf (const gchar *format,
va_list args1) va_list args1)
{ {
gchar *buffer; 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; va_list args2;
G_VA_COPY (args2, args1); G_VA_COPY (args2, args1);
@ -117,6 +126,8 @@ g_strdup_vprintf (const gchar *format,
vsprintf (buffer, format, args2); vsprintf (buffer, format, args2);
va_end (args2); va_end (args2);
#endif /* (HAVE_VASPRINTF) && !(ENABLE_MEM_CHECK) */
return buffer; return buffer;
} }

View File

@ -108,6 +108,15 @@ g_strdup_vprintf (const gchar *format,
va_list args1) va_list args1)
{ {
gchar *buffer; 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; va_list args2;
G_VA_COPY (args2, args1); G_VA_COPY (args2, args1);
@ -117,6 +126,8 @@ g_strdup_vprintf (const gchar *format,
vsprintf (buffer, format, args2); vsprintf (buffer, format, args2);
va_end (args2); va_end (args2);
#endif /* (HAVE_VASPRINTF) && !(ENABLE_MEM_CHECK) */
return buffer; return buffer;
} }