+Fri Jan 1 17:09:19 EST 1999 Jeff Garzik <jgarzik@pobox.com>
+
+ * configure.in, glib.h:
+ Added two new alloca-based function macros, g_strdup_a and
+ g_strconcat_a. These are stack-based and much faster than
+ their g_malloc-based counterparts. Kudos to Ulrich Drepper
+ for help on this one.
+
Wed Dec 30 18:24:57 CST 1998 Shawn T. Amundson <amundson@gtk.org>
* Released GLib 1.1.11
+Fri Jan 1 17:09:19 EST 1999 Jeff Garzik <jgarzik@pobox.com>
+
+ * configure.in, glib.h:
+ Added two new alloca-based function macros, g_strdup_a and
+ g_strconcat_a. These are stack-based and much faster than
+ their g_malloc-based counterparts. Kudos to Ulrich Drepper
+ for help on this one.
+
Wed Dec 30 18:24:57 CST 1998 Shawn T. Amundson <amundson@gtk.org>
* Released GLib 1.1.11
+Fri Jan 1 17:09:19 EST 1999 Jeff Garzik <jgarzik@pobox.com>
+
+ * configure.in, glib.h:
+ Added two new alloca-based function macros, g_strdup_a and
+ g_strconcat_a. These are stack-based and much faster than
+ their g_malloc-based counterparts. Kudos to Ulrich Drepper
+ for help on this one.
+
Wed Dec 30 18:24:57 CST 1998 Shawn T. Amundson <amundson@gtk.org>
* Released GLib 1.1.11
+Fri Jan 1 17:09:19 EST 1999 Jeff Garzik <jgarzik@pobox.com>
+
+ * configure.in, glib.h:
+ Added two new alloca-based function macros, g_strdup_a and
+ g_strconcat_a. These are stack-based and much faster than
+ their g_malloc-based counterparts. Kudos to Ulrich Drepper
+ for help on this one.
+
Wed Dec 30 18:24:57 CST 1998 Shawn T. Amundson <amundson@gtk.org>
* Released GLib 1.1.11
+Fri Jan 1 17:09:19 EST 1999 Jeff Garzik <jgarzik@pobox.com>
+
+ * configure.in, glib.h:
+ Added two new alloca-based function macros, g_strdup_a and
+ g_strconcat_a. These are stack-based and much faster than
+ their g_malloc-based counterparts. Kudos to Ulrich Drepper
+ for help on this one.
+
Wed Dec 30 18:24:57 CST 1998 Shawn T. Amundson <amundson@gtk.org>
* Released GLib 1.1.11
+Fri Jan 1 17:09:19 EST 1999 Jeff Garzik <jgarzik@pobox.com>
+
+ * configure.in, glib.h:
+ Added two new alloca-based function macros, g_strdup_a and
+ g_strconcat_a. These are stack-based and much faster than
+ their g_malloc-based counterparts. Kudos to Ulrich Drepper
+ for help on this one.
+
Wed Dec 30 18:24:57 CST 1998 Shawn T. Amundson <amundson@gtk.org>
* Released GLib 1.1.11
+Fri Jan 1 17:09:19 EST 1999 Jeff Garzik <jgarzik@pobox.com>
+
+ * configure.in, glib.h:
+ Added two new alloca-based function macros, g_strdup_a and
+ g_strconcat_a. These are stack-based and much faster than
+ their g_malloc-based counterparts. Kudos to Ulrich Drepper
+ for help on this one.
+
Wed Dec 30 18:24:57 CST 1998 Shawn T. Amundson <amundson@gtk.org>
* Released GLib 1.1.11
+Fri Jan 1 17:09:19 EST 1999 Jeff Garzik <jgarzik@pobox.com>
+
+ * configure.in, glib.h:
+ Added two new alloca-based function macros, g_strdup_a and
+ g_strconcat_a. These are stack-based and much faster than
+ their g_malloc-based counterparts. Kudos to Ulrich Drepper
+ for help on this one.
+
Wed Dec 30 18:24:57 CST 1998 Shawn T. Amundson <amundson@gtk.org>
* Released GLib 1.1.11
# Checks for library functions.
AC_FUNC_VPRINTF
+AC_FUNC_ALLOCA
+if test "x$ac_cv_func_alloca_works" = xyes; then
+ glib_have_alloca=yes
+else
+ glib_have_alloca=no
+fi
AC_CHECK_FUNCS(atexit on_exit)
AC_CHECK_HEADERS(sys/times.h, AC_DEFINE(HAVE_SYS_TIMES_H))
AC_CHECK_HEADERS(unistd.h, AC_DEFINE(HAVE_UNISTD_H))
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)
cat >>$outfile <<_______EOF
$glib_atexit
$glib_memmove
+$glib_alloca
$glib_defines
$glib_vacopy
#define G_HAVE_BROKEN_WCTYPE 1"
fi
+if test x$glib_have_alloca = xyes; then
+ glib_alloca="
+
+/* alloca support */"
+
+ if test x$glib_have_alloca_h = xyes; then
+ glib_alloca="\$glib_alloca
+#define G_HAVE_ALLOCA_H 1"
+ fi
+
+ glib_alloca="\$glib_alloca
+#define G_HAVE_ALLOCA 1
+
+/* BEGIN autoconf 2.13 alloca incantation
+ NOTE: Do not un-indent the #pragma below. */
+/* AIX requires this to be the first thing in the file. */
+#ifdef __GNUC__
+# ifndef alloca
+# define alloca __builtin_alloca
+# endif
+#else
+# if G_HAVE_ALLOCA_H
+# include <alloca.h>
+# else
+# ifdef _AIX
+ #pragma alloca
+# else
+# ifndef alloca /* predefined by HP cc +Olibcalls */
+char *alloca ();
+# endif
+# endif
+# endif
+#endif
+/* END autoconf 2.13 alloca incantation */
+
+
+"
+fi
+
case x$enable_threads in
xyes) g_enable_threads_def="#define";;
*) g_enable_threads_def="#undef ";;
gpointer g_memdup (gconstpointer mem,
guint byte_size);
+/* Macros for dynamic strings via fast stack allocation
+ * All macros take a special first argument: the target gchar* string
+ */
+#if G_HAVE_ALLOCA
+
+# define g_strdup_a(newstr,str) G_STMT_START { \
+ const char *__old = (str); \
+ char *__new; \
+ size_t __len = strlen (__old) + 1; \
+ __new = alloca (__len); \
+ memcpy (__new, __old, __len); \
+ (newstr) = __new; \
+ } G_STMT_END
+
+# define g_strconcat_a(newstr,str1,str2,str3) G_STMT_START { \
+ size_t __len1 = ((str1) == (gchar*)NULL) ? 0 : strlen((str1)); \
+ size_t __len2 = ((str2) == (gchar*)NULL) ? 0 : strlen((str2)); \
+ size_t __len3 = ((str3) == (gchar*)NULL) ? 0 : strlen((str3)); \
+ char *__sptr, *__new = \
+ alloca (__len1 + __len2 + __len3 + 1); \
+ __sptr = __new; \
+ if (__len1){memcpy (__sptr, (str1), __len1); __sptr += __len1;} \
+ if (__len2){memcpy (__sptr, (str2), __len2); __sptr += __len2;} \
+ if (__len3){memcpy (__sptr, (str3), __len3); __sptr += __len3;} \
+ *__sptr = '\0'; \
+ (newstr) = __new; \
+ } G_STMT_END
+
+#endif /* G_HAVE_ALLOCA */
+
+
/* NULL terminated string arrays.
* g_strsplit() splits up string into max_tokens tokens at delim and
* returns a newly allocated string array.
gpointer g_memdup (gconstpointer mem,
guint byte_size);
+/* Macros for dynamic strings via fast stack allocation
+ * All macros take a special first argument: the target gchar* string
+ */
+#if G_HAVE_ALLOCA
+
+# define g_strdup_a(newstr,str) G_STMT_START { \
+ const char *__old = (str); \
+ char *__new; \
+ size_t __len = strlen (__old) + 1; \
+ __new = alloca (__len); \
+ memcpy (__new, __old, __len); \
+ (newstr) = __new; \
+ } G_STMT_END
+
+# define g_strconcat_a(newstr,str1,str2,str3) G_STMT_START { \
+ size_t __len1 = ((str1) == (gchar*)NULL) ? 0 : strlen((str1)); \
+ size_t __len2 = ((str2) == (gchar*)NULL) ? 0 : strlen((str2)); \
+ size_t __len3 = ((str3) == (gchar*)NULL) ? 0 : strlen((str3)); \
+ char *__sptr, *__new = \
+ alloca (__len1 + __len2 + __len3 + 1); \
+ __sptr = __new; \
+ if (__len1){memcpy (__sptr, (str1), __len1); __sptr += __len1;} \
+ if (__len2){memcpy (__sptr, (str2), __len2); __sptr += __len2;} \
+ if (__len3){memcpy (__sptr, (str3), __len3); __sptr += __len3;} \
+ *__sptr = '\0'; \
+ (newstr) = __new; \
+ } G_STMT_END
+
+#endif /* G_HAVE_ALLOCA */
+
+
/* NULL terminated string arrays.
* g_strsplit() splits up string into max_tokens tokens at delim and
* returns a newly allocated string array.