summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--ChangeLog.pre-2-09
-rw-r--r--ChangeLog.pre-2-109
-rw-r--r--ChangeLog.pre-2-129
-rw-r--r--ChangeLog.pre-2-29
-rw-r--r--ChangeLog.pre-2-49
-rw-r--r--ChangeLog.pre-2-69
-rw-r--r--ChangeLog.pre-2-89
-rw-r--r--configure.in49
-rw-r--r--glib.h75
-rw-r--r--glib/glib.h75
-rw-r--r--glib/gstrfuncs.c11
-rw-r--r--gstrfuncs.c11
-rw-r--r--testglib.c52
-rw-r--r--tests/.cvsignore1
-rw-r--r--tests/Makefile.am2
-rw-r--r--tests/alloca-test.c88
-rw-r--r--tests/testglib.c52
18 files changed, 73 insertions, 415 deletions
diff --git a/ChangeLog b/ChangeLog
index 788e21168..5551b94c9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+1999-01-11 Jeff Garzik <jgarzik@pobox.com>
+
+ * gstrfuncs.c:
+ Do not use vasprintf.
+
+ * configure.in, glib.h, testglib.c, tests/.cvsignore,
+ tests/Makefile.am, tests/alloca-test.c:
+ Do not use alloca.
+
1999-01-11 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* configure.in: Test for localtime_r only after including the
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index 788e21168..5551b94c9 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -1,3 +1,12 @@
+1999-01-11 Jeff Garzik <jgarzik@pobox.com>
+
+ * gstrfuncs.c:
+ Do not use vasprintf.
+
+ * configure.in, glib.h, testglib.c, tests/.cvsignore,
+ tests/Makefile.am, tests/alloca-test.c:
+ Do not use alloca.
+
1999-01-11 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* configure.in: Test for localtime_r only after including the
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index 788e21168..5551b94c9 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,12 @@
+1999-01-11 Jeff Garzik <jgarzik@pobox.com>
+
+ * gstrfuncs.c:
+ Do not use vasprintf.
+
+ * configure.in, glib.h, testglib.c, tests/.cvsignore,
+ tests/Makefile.am, tests/alloca-test.c:
+ Do not use alloca.
+
1999-01-11 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* configure.in: Test for localtime_r only after including the
diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12
index 788e21168..5551b94c9 100644
--- a/ChangeLog.pre-2-12
+++ b/ChangeLog.pre-2-12
@@ -1,3 +1,12 @@
+1999-01-11 Jeff Garzik <jgarzik@pobox.com>
+
+ * gstrfuncs.c:
+ Do not use vasprintf.
+
+ * configure.in, glib.h, testglib.c, tests/.cvsignore,
+ tests/Makefile.am, tests/alloca-test.c:
+ Do not use alloca.
+
1999-01-11 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* configure.in: Test for localtime_r only after including the
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index 788e21168..5551b94c9 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,3 +1,12 @@
+1999-01-11 Jeff Garzik <jgarzik@pobox.com>
+
+ * gstrfuncs.c:
+ Do not use vasprintf.
+
+ * configure.in, glib.h, testglib.c, tests/.cvsignore,
+ tests/Makefile.am, tests/alloca-test.c:
+ Do not use alloca.
+
1999-01-11 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* configure.in: Test for localtime_r only after including the
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index 788e21168..5551b94c9 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,12 @@
+1999-01-11 Jeff Garzik <jgarzik@pobox.com>
+
+ * gstrfuncs.c:
+ Do not use vasprintf.
+
+ * configure.in, glib.h, testglib.c, tests/.cvsignore,
+ tests/Makefile.am, tests/alloca-test.c:
+ Do not use alloca.
+
1999-01-11 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* configure.in: Test for localtime_r only after including the
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index 788e21168..5551b94c9 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,12 @@
+1999-01-11 Jeff Garzik <jgarzik@pobox.com>
+
+ * gstrfuncs.c:
+ Do not use vasprintf.
+
+ * configure.in, glib.h, testglib.c, tests/.cvsignore,
+ tests/Makefile.am, tests/alloca-test.c:
+ Do not use alloca.
+
1999-01-11 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* configure.in: Test for localtime_r only after including the
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index 788e21168..5551b94c9 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,12 @@
+1999-01-11 Jeff Garzik <jgarzik@pobox.com>
+
+ * gstrfuncs.c:
+ Do not use vasprintf.
+
+ * configure.in, glib.h, testglib.c, tests/.cvsignore,
+ tests/Makefile.am, tests/alloca-test.c:
+ Do not use alloca.
+
1999-01-11 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* configure.in: Test for localtime_r only after including the
diff --git a/configure.in b/configure.in
index fab8f45c5..fdbc6dac3 100644
--- a/configure.in
+++ b/configure.in
@@ -168,12 +168,6 @@ AC_HEADER_STDC
# 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)
@@ -251,10 +245,9 @@ AC_CHECK_HEADERS(sys/time.h, AC_DEFINE(HAVE_SYS_TIME_H))
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 vasprintf strcasecmp strncasecmp poll)
+AC_CHECK_FUNCS(lstat strerror strsignal memmove vsnprintf strcasecmp strncasecmp poll)
# Check for sys_errlist
AC_MSG_CHECKING(for sys_errlist)
@@ -870,7 +863,6 @@ _______EOF
cat >>$outfile <<_______EOF
$glib_atexit
$glib_memmove
-$glib_alloca
$glib_defines
$glib_vacopy
@@ -1136,45 +1128,6 @@ if test x$glib_working_wctype = xno; then
#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 ";;
diff --git a/glib.h b/glib.h
index 682dbd4d7..efc9f278d 100644
--- a/glib.h
+++ b/glib.h
@@ -301,16 +301,6 @@ extern "C" {
((type *) g_realloc (mem, (unsigned) sizeof (type) * (count)))
#endif /* __DMALLOC_H__ */
-/* alloca-based counterparts of the above routines */
-#if G_HAVE_ALLOCA
-# define g_alloca alloca
-# define g_new_a(type, count) \
- ((type *) alloca ((unsigned) sizeof (type) * (count)))
-# define g_new0_a(type, count) \
- ((type *) memset (alloca ((unsigned) sizeof (type) * (count)), 0, \
- ((unsigned) sizeof (type) * (count))))
-#endif /* G_HAVE_ALLOCA */
-
#define g_mem_chunk_create(type, pre_alloc, alloc_type) ( \
g_mem_chunk_new (#type " mem chunks (" #pre_alloc ")", \
sizeof (type), \
@@ -1465,71 +1455,6 @@ gchar* g_strescape (gchar *string);
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 { \
- gchar *__new; \
- const gchar *__old = (str); \
- if (__old) \
- { \
- size_t __len = strlen (__old) + 1; \
- __new = alloca (__len); \
- memcpy (__new, __old, __len); \
- } \
- else \
- __new = NULL; \
- (newstr) = __new; \
- } G_STMT_END
-# define g_strndup_a(newstr,str,n) G_STMT_START { \
- gchar *__new; \
- const gchar *__old = (str); \
- if (__old) \
- { \
- guint __n = (n); \
- size_t __len = strlen (__old); \
- if (__len > (__n)) \
- __len = (__n); \
- __new = alloca (__len + 1); \
- memcpy (__new, __old, __len); \
- __new[__len] = 0; \
- } \
- else \
- __new = NULL; \
- (newstr) = __new; \
- } G_STMT_END
-# define g_strconcat3_a(newstr,str1,str2,str3) G_STMT_START { \
- const gchar *__str1 = (str1); \
- const gchar *__str2 = (str2); \
- const gchar *__str3 = (str3); \
- gchar *__new; \
- if (__str1) { \
- size_t __len1 = strlen (__str1); \
- if (__str2) { \
- size_t __len2 = strlen (__str2); \
- if (__str3) { \
- size_t __len3 = strlen (__str3); \
- __new = alloca (__len1 + __len2 + __len3 + 1); \
- __new[__len1 + __len2 + __len3] = 0; \
- memcpy (__new + __len1 + __len2, __str3, __len3); \
- } else { \
- __new = alloca (__len1 + __len2 + 1); \
- __new[__len1 + __len2] = 0; \
- } \
- memcpy (__new + __len1, __str2, __len2); \
- } else { \
- __new = alloca (__len1 + 1); \
- __new[__len1] = 0; \
- } \
- memcpy (__new, __str1, __len1); \
- } else \
- __new = NULL; \
- (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.
diff --git a/glib/glib.h b/glib/glib.h
index 682dbd4d7..efc9f278d 100644
--- a/glib/glib.h
+++ b/glib/glib.h
@@ -301,16 +301,6 @@ extern "C" {
((type *) g_realloc (mem, (unsigned) sizeof (type) * (count)))
#endif /* __DMALLOC_H__ */
-/* alloca-based counterparts of the above routines */
-#if G_HAVE_ALLOCA
-# define g_alloca alloca
-# define g_new_a(type, count) \
- ((type *) alloca ((unsigned) sizeof (type) * (count)))
-# define g_new0_a(type, count) \
- ((type *) memset (alloca ((unsigned) sizeof (type) * (count)), 0, \
- ((unsigned) sizeof (type) * (count))))
-#endif /* G_HAVE_ALLOCA */
-
#define g_mem_chunk_create(type, pre_alloc, alloc_type) ( \
g_mem_chunk_new (#type " mem chunks (" #pre_alloc ")", \
sizeof (type), \
@@ -1465,71 +1455,6 @@ gchar* g_strescape (gchar *string);
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 { \
- gchar *__new; \
- const gchar *__old = (str); \
- if (__old) \
- { \
- size_t __len = strlen (__old) + 1; \
- __new = alloca (__len); \
- memcpy (__new, __old, __len); \
- } \
- else \
- __new = NULL; \
- (newstr) = __new; \
- } G_STMT_END
-# define g_strndup_a(newstr,str,n) G_STMT_START { \
- gchar *__new; \
- const gchar *__old = (str); \
- if (__old) \
- { \
- guint __n = (n); \
- size_t __len = strlen (__old); \
- if (__len > (__n)) \
- __len = (__n); \
- __new = alloca (__len + 1); \
- memcpy (__new, __old, __len); \
- __new[__len] = 0; \
- } \
- else \
- __new = NULL; \
- (newstr) = __new; \
- } G_STMT_END
-# define g_strconcat3_a(newstr,str1,str2,str3) G_STMT_START { \
- const gchar *__str1 = (str1); \
- const gchar *__str2 = (str2); \
- const gchar *__str3 = (str3); \
- gchar *__new; \
- if (__str1) { \
- size_t __len1 = strlen (__str1); \
- if (__str2) { \
- size_t __len2 = strlen (__str2); \
- if (__str3) { \
- size_t __len3 = strlen (__str3); \
- __new = alloca (__len1 + __len2 + __len3 + 1); \
- __new[__len1 + __len2 + __len3] = 0; \
- memcpy (__new + __len1 + __len2, __str3, __len3); \
- } else { \
- __new = alloca (__len1 + __len2 + 1); \
- __new[__len1 + __len2] = 0; \
- } \
- memcpy (__new + __len1, __str2, __len2); \
- } else { \
- __new = alloca (__len1 + 1); \
- __new[__len1] = 0; \
- } \
- memcpy (__new, __str1, __len1); \
- } else \
- __new = NULL; \
- (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.
diff --git a/glib/gstrfuncs.c b/glib/gstrfuncs.c
index 6e58ad5e0..e154c56dc 100644
--- a/glib/gstrfuncs.c
+++ b/glib/gstrfuncs.c
@@ -108,15 +108,6 @@ 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);
@@ -126,8 +117,6 @@ g_strdup_vprintf (const gchar *format,
vsprintf (buffer, format, args2);
va_end (args2);
-#endif /* (HAVE_VASPRINTF) && !(ENABLE_MEM_CHECK) */
-
return buffer;
}
diff --git a/gstrfuncs.c b/gstrfuncs.c
index 6e58ad5e0..e154c56dc 100644
--- a/gstrfuncs.c
+++ b/gstrfuncs.c
@@ -108,15 +108,6 @@ 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);
@@ -126,8 +117,6 @@ g_strdup_vprintf (const gchar *format,
vsprintf (buffer, format, args2);
va_end (args2);
-#endif /* (HAVE_VASPRINTF) && !(ENABLE_MEM_CHECK) */
-
return buffer;
}
diff --git a/testglib.c b/testglib.c
index 8cc315c89..c93d65c2b 100644
--- a/testglib.c
+++ b/testglib.c
@@ -910,58 +910,6 @@ main (int argc,
#endif
g_print ("ok\n");
-#ifdef G_HAVE_ALLOCA
- g_print ("checking alloca()-based allocation routines...");
-
- string = g_alloca(80);
- g_assert(string != NULL);
- for (i = 0; i < 80; i++)
- string[i] = 'x';
- string[79] = 0;
- g_assert(strlen(string) == 79);
-
- gti = g_new_a(GlibTestInfo, 2);
- string = g_alloca(2);
- strcpy(string, "x");
- for (i = 0; i < 2; i++) {
- for (j = 0; j < 40; j++)
- gti[i].name[j] = 'x';
- gti[i].name[39] = 0;
- g_assert(strlen(gti[i].name) == 39);
- gti[i].age = 42;
- }
- g_assert(strcmp(string, "x") == 0);
-
- string = g_new0_a(char, 40);
- for (i = 0; i < 39; i++)
- string[i] = 'x';
- g_assert(strlen(string) == 39);
-
- g_print ("ok\n");
-
- g_print ("checking alloca()-based string duplication routines...");
-
- g_strdup_a(string, GLIB_TEST_STRING);
- g_assert(string != NULL);
- g_assert(strcmp(string, GLIB_TEST_STRING) == 0);
- g_strdup_a(string, NULL);
- g_assert(string == NULL);
-
- g_strndup_a(string, GLIB_TEST_STRING, 5);
- g_assert(string != NULL);
- g_assert(strlen(string) == 5);
- g_assert(strcmp(string, GLIB_TEST_STRING_5) == 0);
- g_strndup_a(string, NULL, 20);
- g_assert(string == NULL);
-
- g_strconcat3_a(string, GLIB_TEST_STRING, GLIB_TEST_STRING, GLIB_TEST_STRING);
- g_assert(string != NULL);
- g_assert(strcmp(string, GLIB_TEST_STRING GLIB_TEST_STRING
- GLIB_TEST_STRING) == 0);
-
- g_print ("ok\n");
-#endif
-
return 0;
}
diff --git a/tests/.cvsignore b/tests/.cvsignore
index b23a68aee..b56bcd02f 100644
--- a/tests/.cvsignore
+++ b/tests/.cvsignore
@@ -22,7 +22,6 @@ stamp-gc-h
testgdate
testgdateparser
glibconfig-sysdefs.h
-alloca-test
hash-test
list-test
node-test
diff --git a/tests/Makefile.am b/tests/Makefile.am
index b648df8de..b93487b83 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -2,7 +2,6 @@
INCLUDES = -I$(top_srcdir)
TESTS = \
- alloca-test \
array-test \
dirname-test \
hash-test \
@@ -16,7 +15,6 @@ TESTS = \
noinst_PROGRAMS = $(TESTS)
-alloca_test_LDADD = $(top_builddir)/libglib.la
array_test_LDADD = $(top_builddir)/libglib.la
dirname_test_LDADD = $(top_builddir)/libglib.la
hash_test_LDADD = $(top_builddir)/libglib.la
diff --git a/tests/alloca-test.c b/tests/alloca-test.c
deleted file mode 100644
index 0d1b02f78..000000000
--- a/tests/alloca-test.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/* GLIB - Library of useful routines for C programming
- * 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
- * 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.
- *
- * You should have received a copy of the GNU Library 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.
- */
-#undef G_LOG_DOMAIN
-
-#include <stdio.h>
-#include <string.h>
-#include "../glib.h"
-
-#define GLIB_TEST_STRING "el dorado "
-#define GLIB_TEST_STRING_5 "el do"
-
-typedef struct {
- guint age;
- gchar name[40];
-} GlibTestInfo;
-
-int
-main (int argc,
- char *argv[])
-{
- gchar *string;
- GlibTestInfo *gti;
- gint i, j;
-
- string = g_alloca(80);
- g_assert(string != NULL);
- for (i = 0; i < 80; i++)
- string[i] = 'x';
- string[79] = 0;
- g_assert(strlen(string) == 79);
-
- gti = g_new_a(GlibTestInfo, 2);
- string = g_alloca(2);
- strcpy(string, "x");
- for (i = 0; i < 2; i++) {
- for (j = 0; j < 40; j++)
- gti[i].name[j] = 'x';
- gti[i].name[39] = 0;
- g_assert(strlen(gti[i].name) == 39);
- gti[i].age = 42;
- }
- g_assert(strcmp(string, "x") == 0);
-
- string = g_new0_a(char, 40);
- for (i = 0; i < 39; i++)
- string[i] = 'x';
- g_assert(strlen(string) == 39);
-
- g_strdup_a(string, GLIB_TEST_STRING);
- g_assert(string != NULL);
- g_assert(strcmp(string, GLIB_TEST_STRING) == 0);
- g_strdup_a(string, NULL);
- g_assert(string == NULL);
-
- g_strndup_a(string, GLIB_TEST_STRING, 5);
- g_assert(string != NULL);
- g_assert(strlen(string) == 5);
- g_assert(strcmp(string, GLIB_TEST_STRING_5) == 0);
- g_strndup_a(string, NULL, 20);
- g_assert(string == NULL);
-
- g_strconcat3_a(string, GLIB_TEST_STRING, GLIB_TEST_STRING, GLIB_TEST_STRING);
- g_assert(string != NULL);
- g_assert(strcmp(string, GLIB_TEST_STRING GLIB_TEST_STRING
- GLIB_TEST_STRING) == 0);
- g_strconcat3_a (string, "1", NULL, "2");
- g_assert (strcmp (string, "1") == 0);
-
-
- return 0;
-}
-
diff --git a/tests/testglib.c b/tests/testglib.c
index 8cc315c89..c93d65c2b 100644
--- a/tests/testglib.c
+++ b/tests/testglib.c
@@ -910,58 +910,6 @@ main (int argc,
#endif
g_print ("ok\n");
-#ifdef G_HAVE_ALLOCA
- g_print ("checking alloca()-based allocation routines...");
-
- string = g_alloca(80);
- g_assert(string != NULL);
- for (i = 0; i < 80; i++)
- string[i] = 'x';
- string[79] = 0;
- g_assert(strlen(string) == 79);
-
- gti = g_new_a(GlibTestInfo, 2);
- string = g_alloca(2);
- strcpy(string, "x");
- for (i = 0; i < 2; i++) {
- for (j = 0; j < 40; j++)
- gti[i].name[j] = 'x';
- gti[i].name[39] = 0;
- g_assert(strlen(gti[i].name) == 39);
- gti[i].age = 42;
- }
- g_assert(strcmp(string, "x") == 0);
-
- string = g_new0_a(char, 40);
- for (i = 0; i < 39; i++)
- string[i] = 'x';
- g_assert(strlen(string) == 39);
-
- g_print ("ok\n");
-
- g_print ("checking alloca()-based string duplication routines...");
-
- g_strdup_a(string, GLIB_TEST_STRING);
- g_assert(string != NULL);
- g_assert(strcmp(string, GLIB_TEST_STRING) == 0);
- g_strdup_a(string, NULL);
- g_assert(string == NULL);
-
- g_strndup_a(string, GLIB_TEST_STRING, 5);
- g_assert(string != NULL);
- g_assert(strlen(string) == 5);
- g_assert(strcmp(string, GLIB_TEST_STRING_5) == 0);
- g_strndup_a(string, NULL, 20);
- g_assert(string == NULL);
-
- g_strconcat3_a(string, GLIB_TEST_STRING, GLIB_TEST_STRING, GLIB_TEST_STRING);
- g_assert(string != NULL);
- g_assert(strcmp(string, GLIB_TEST_STRING GLIB_TEST_STRING
- GLIB_TEST_STRING) == 0);
-
- g_print ("ok\n");
-#endif
-
return 0;
}