Add checks for alloca, defining G_NATIVE_ALLOCA if present.
Fri Jan 22 13:41:41 EST 1999 Jeff Garzik <jgarzik@pobox.com>
* configure.in:
Add checks for alloca, defining G_NATIVE_ALLOCA if present.
* galloca.c:
Import replacement alloca implementation from gettext 0.10.35.
Begin to convert to using GLib types and functions.
* glib.h:
New macros g_alloca, g_alloca_gc, g_alloca_new, to perform
stack-based memory allocations.
* tests/Makefile.am, tests/queue-test.c, tests/alloca-test.c:
New tests for g_alloca_*, GQueue ADT.
* tests/stack-test.c:
Fix pointer casts, include config.h, and
call g_stack_free at end of run.
1999-01-22 19:33:26 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
1999-01-22 17:23:13 +00:00
|
|
|
#include <glib.h>
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
GStack *s;
|
|
|
|
|
|
|
|
s = g_stack_new ();
|
|
|
|
|
|
|
|
g_stack_push (s, GINT_TO_POINTER (1));
|
|
|
|
g_assert (g_list_length (s->list) == 1);
|
|
|
|
g_stack_push (s, GINT_TO_POINTER (2));
|
|
|
|
g_assert (g_list_length (s->list) == 2);
|
|
|
|
g_stack_push (s, GINT_TO_POINTER (3));
|
|
|
|
g_assert (g_list_length (s->list) == 3);
|
|
|
|
g_stack_push (s, GINT_TO_POINTER (4));
|
|
|
|
g_assert (g_list_length (s->list) == 4);
|
|
|
|
g_stack_push (s, GINT_TO_POINTER (5));
|
|
|
|
g_assert (g_list_length (s->list) == 5);
|
|
|
|
|
Add checks for alloca, defining G_NATIVE_ALLOCA if present.
Fri Jan 22 13:41:41 EST 1999 Jeff Garzik <jgarzik@pobox.com>
* configure.in:
Add checks for alloca, defining G_NATIVE_ALLOCA if present.
* galloca.c:
Import replacement alloca implementation from gettext 0.10.35.
Begin to convert to using GLib types and functions.
* glib.h:
New macros g_alloca, g_alloca_gc, g_alloca_new, to perform
stack-based memory allocations.
* tests/Makefile.am, tests/queue-test.c, tests/alloca-test.c:
New tests for g_alloca_*, GQueue ADT.
* tests/stack-test.c:
Fix pointer casts, include config.h, and
call g_stack_free at end of run.
1999-01-22 19:33:26 +00:00
|
|
|
g_assert (g_stack_pop (s) == GINT_TO_POINTER (5));
|
1999-01-22 17:23:13 +00:00
|
|
|
g_assert (g_list_length (s->list) == 4);
|
Add checks for alloca, defining G_NATIVE_ALLOCA if present.
Fri Jan 22 13:41:41 EST 1999 Jeff Garzik <jgarzik@pobox.com>
* configure.in:
Add checks for alloca, defining G_NATIVE_ALLOCA if present.
* galloca.c:
Import replacement alloca implementation from gettext 0.10.35.
Begin to convert to using GLib types and functions.
* glib.h:
New macros g_alloca, g_alloca_gc, g_alloca_new, to perform
stack-based memory allocations.
* tests/Makefile.am, tests/queue-test.c, tests/alloca-test.c:
New tests for g_alloca_*, GQueue ADT.
* tests/stack-test.c:
Fix pointer casts, include config.h, and
call g_stack_free at end of run.
1999-01-22 19:33:26 +00:00
|
|
|
g_assert (g_stack_pop (s) == GINT_TO_POINTER (4));
|
1999-01-22 17:23:13 +00:00
|
|
|
g_assert (g_list_length (s->list) == 3);
|
Add checks for alloca, defining G_NATIVE_ALLOCA if present.
Fri Jan 22 13:41:41 EST 1999 Jeff Garzik <jgarzik@pobox.com>
* configure.in:
Add checks for alloca, defining G_NATIVE_ALLOCA if present.
* galloca.c:
Import replacement alloca implementation from gettext 0.10.35.
Begin to convert to using GLib types and functions.
* glib.h:
New macros g_alloca, g_alloca_gc, g_alloca_new, to perform
stack-based memory allocations.
* tests/Makefile.am, tests/queue-test.c, tests/alloca-test.c:
New tests for g_alloca_*, GQueue ADT.
* tests/stack-test.c:
Fix pointer casts, include config.h, and
call g_stack_free at end of run.
1999-01-22 19:33:26 +00:00
|
|
|
g_assert (g_stack_pop (s) == GINT_TO_POINTER (3));
|
1999-01-22 17:23:13 +00:00
|
|
|
g_assert (g_list_length (s->list) == 2);
|
Add checks for alloca, defining G_NATIVE_ALLOCA if present.
Fri Jan 22 13:41:41 EST 1999 Jeff Garzik <jgarzik@pobox.com>
* configure.in:
Add checks for alloca, defining G_NATIVE_ALLOCA if present.
* galloca.c:
Import replacement alloca implementation from gettext 0.10.35.
Begin to convert to using GLib types and functions.
* glib.h:
New macros g_alloca, g_alloca_gc, g_alloca_new, to perform
stack-based memory allocations.
* tests/Makefile.am, tests/queue-test.c, tests/alloca-test.c:
New tests for g_alloca_*, GQueue ADT.
* tests/stack-test.c:
Fix pointer casts, include config.h, and
call g_stack_free at end of run.
1999-01-22 19:33:26 +00:00
|
|
|
g_assert (g_stack_pop (s) == GINT_TO_POINTER (2));
|
1999-01-22 17:23:13 +00:00
|
|
|
g_assert (g_list_length (s->list) == 1);
|
Add checks for alloca, defining G_NATIVE_ALLOCA if present.
Fri Jan 22 13:41:41 EST 1999 Jeff Garzik <jgarzik@pobox.com>
* configure.in:
Add checks for alloca, defining G_NATIVE_ALLOCA if present.
* galloca.c:
Import replacement alloca implementation from gettext 0.10.35.
Begin to convert to using GLib types and functions.
* glib.h:
New macros g_alloca, g_alloca_gc, g_alloca_new, to perform
stack-based memory allocations.
* tests/Makefile.am, tests/queue-test.c, tests/alloca-test.c:
New tests for g_alloca_*, GQueue ADT.
* tests/stack-test.c:
Fix pointer casts, include config.h, and
call g_stack_free at end of run.
1999-01-22 19:33:26 +00:00
|
|
|
g_assert (g_stack_pop (s) == GINT_TO_POINTER (1));
|
1999-01-22 17:23:13 +00:00
|
|
|
g_assert (g_list_length (s->list) == 0);
|
|
|
|
g_assert (g_stack_pop (s) == NULL);
|
|
|
|
g_assert (g_list_length (s->list) == 0);
|
|
|
|
g_assert (g_stack_pop (s) == NULL);
|
|
|
|
g_assert (g_list_length (s->list) == 0);
|
|
|
|
|
Add checks for alloca, defining G_NATIVE_ALLOCA if present.
Fri Jan 22 13:41:41 EST 1999 Jeff Garzik <jgarzik@pobox.com>
* configure.in:
Add checks for alloca, defining G_NATIVE_ALLOCA if present.
* galloca.c:
Import replacement alloca implementation from gettext 0.10.35.
Begin to convert to using GLib types and functions.
* glib.h:
New macros g_alloca, g_alloca_gc, g_alloca_new, to perform
stack-based memory allocations.
* tests/Makefile.am, tests/queue-test.c, tests/alloca-test.c:
New tests for g_alloca_*, GQueue ADT.
* tests/stack-test.c:
Fix pointer casts, include config.h, and
call g_stack_free at end of run.
1999-01-22 19:33:26 +00:00
|
|
|
g_stack_free (s);
|
|
|
|
|
1999-01-22 17:23:13 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|