From d32bd8bb11f2644cbe35b396a7a40a7e359ceee9 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Sat, 24 Dec 2016 07:43:50 +0100 Subject: obstack removed, glibc compat is gone --- test/malloc/Makefile.in | 4 -- test/malloc/tst-malloc.c | 4 -- test/malloc/tst-mcheck.c | 4 -- test/malloc/tst-obstack.c | 104 ---------------------------------------------- 4 files changed, 116 deletions(-) delete mode 100644 test/malloc/tst-obstack.c diff --git a/test/malloc/Makefile.in b/test/malloc/Makefile.in index 7d9577a..d3dcd57 100644 --- a/test/malloc/Makefile.in +++ b/test/malloc/Makefile.in @@ -3,10 +3,6 @@ TESTS_DISABLED := time_malloc -ifneq ($(UCLIBC_HAS_OBSTACK),y) -TESTS_DISABLED += tst-obstack -endif - ifneq ($(MALLOC_STANDARD),y) TESTS_DISABLED += tst-asprintf endif diff --git a/test/malloc/tst-malloc.c b/test/malloc/tst-malloc.c index 2d3bcce..976fbd3 100644 --- a/test/malloc/tst-malloc.c +++ b/test/malloc/tst-malloc.c @@ -57,11 +57,7 @@ main (void) merror ("realloc (p, 0) failed."); p = malloc (0); -#if !defined(__UCLIBC__) || defined(__MALLOC_GLIBC_COMPAT__) if (p == NULL) -#else - if (p != NULL) -#endif merror ("malloc (0) failed."); p = realloc (p, 0); diff --git a/test/malloc/tst-mcheck.c b/test/malloc/tst-mcheck.c index 9297d79..a24f471 100644 --- a/test/malloc/tst-mcheck.c +++ b/test/malloc/tst-mcheck.c @@ -53,11 +53,7 @@ main (void) merror ("realloc (p, 0) failed."); p = malloc (0); -#if !defined(__UCLIBC__) || defined(__MALLOC_GLIBC_COMPAT__) if (p == NULL) -#else - if (p != NULL) -#endif merror ("malloc (0) failed."); p = realloc (p, 0); diff --git a/test/malloc/tst-obstack.c b/test/malloc/tst-obstack.c deleted file mode 100644 index 1841946..0000000 --- a/test/malloc/tst-obstack.c +++ /dev/null @@ -1,104 +0,0 @@ -/* Test case by Alexandre Duret-Lutz . - * test_obstack_printf() added by Anthony G. Basile . - */ - -#include -#include -#include -#include -#include - -#define obstack_chunk_alloc verbose_malloc -#define obstack_chunk_free verbose_free -#define ALIGN_BOUNDARY 64 -#define ALIGN_MASK (ALIGN_BOUNDARY - 1) -#define OBJECT_SIZE 1000 - -static void * -verbose_malloc (size_t size) -{ - void *buf = malloc (size); - printf ("malloc (%zu) => %p\n", size, buf); - return buf; -} - -static void -verbose_free (void *buf) -{ - free (buf); - printf ("free (%p)\n", buf); -} - -int -test_obstack_alloc (void) -{ - int result = 0; - int align = 2; - - while (align <= 64) - { - struct obstack obs; - int i; - int align_mask = align - 1; - - printf ("\n Alignment mask: %d\n", align_mask); - - obstack_init (&obs); - obstack_alignment_mask (&obs) = align_mask; - /* finish an empty object to take alignment into account */ - obstack_finish (&obs); - - /* let's allocate some objects and print their addresses */ - for (i = 15; i > 0; --i) - { - void *obj = obstack_alloc (&obs, OBJECT_SIZE); - - printf ("obstack_alloc (%u) => %p \t%s\n", OBJECT_SIZE, obj, - ((uintptr_t) obj & align_mask) ? "(not aligned)" : ""); - result |= ((uintptr_t) obj & align_mask) != 0; - } - - /* clean up */ - obstack_free (&obs, 0); - - align <<= 1; - } - - return result; -} - -int -test_obstack_printf (void) -{ - int result = 0; - int n; - char *s; - struct obstack ob; - - obstack_init (&ob); - - n = obstack_printf (&ob, "%s%d%c", "testing 1 ... 2 ... ", 3, '\n'); - result |= (n != 22); - printf("obstack_printf => %d\n", n); - - n = obstack_printf (&ob, "%s%d%c", "testing 3 ... 2 ... ", 1, '\0'); - result |= (n != 22); - printf("obstack_printf => %d\n", n); - - s = obstack_finish (&ob); - printf("obstack_printf => %s\n", s); - obstack_free (&ob, NULL); - - return result; -} - -int -main (void) -{ - int result = 0; - - result |= test_obstack_alloc(); - result |= test_obstack_printf(); - - return result; -} -- cgit v1.2.3