Changeset View
Changeset View
Standalone View
Standalone View
tests/manual/test.cpp
Show All 13 Lines | |||||
14 | * You should have received a copy of the GNU Lesser General Public | 14 | * You should have received a copy of the GNU Lesser General Public | ||
15 | * License along with this library; if not, write to the Free Software | 15 | * License along with this library; if not, write to the Free Software | ||
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
17 | */ | 17 | */ | ||
18 | 18 | | |||
19 | #include <cstdio> | 19 | #include <cstdio> | ||
20 | #include <cstdlib> | 20 | #include <cstdlib> | ||
21 | 21 | | |||
22 | #include "util/config.h" | ||||
23 | | ||||
22 | #if defined(_ISOC11_SOURCE) | 24 | #if defined(_ISOC11_SOURCE) | ||
23 | # define HAVE_ALIGNED_ALLOC 1 | 25 | # define HAVE_ALIGNED_ALLOC 1 | ||
24 | #else | 26 | #else | ||
25 | # define HAVE_ALIGNED_ALLOC 0 | 27 | # define HAVE_ALIGNED_ALLOC 0 | ||
26 | #endif | 28 | #endif | ||
27 | 29 | | |||
28 | struct Foo | 30 | struct Foo | ||
29 | { | 31 | { | ||
▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Line(s) | 70 | { | |||
77 | void* buf = malloc(100); | 79 | void* buf = malloc(100); | ||
78 | printf("malloc: %p\n", buf); | 80 | printf("malloc: %p\n", buf); | ||
79 | buf = realloc(buf, 200); | 81 | buf = realloc(buf, 200); | ||
80 | printf("realloc: %p\n", buf); | 82 | printf("realloc: %p\n", buf); | ||
81 | free(buf); | 83 | free(buf); | ||
82 | 84 | | |||
83 | buf = calloc(5, 5); | 85 | buf = calloc(5, 5); | ||
84 | printf("calloc: %p\n", buf); | 86 | printf("calloc: %p\n", buf); | ||
87 | #if HAVE_CFREE | ||||
85 | cfree(buf); | 88 | cfree(buf); | ||
89 | #else | ||||
90 | free(buf); | ||||
91 | #endif | ||||
86 | 92 | | |||
87 | #if HAVE_ALIGNED_ALLOC | 93 | #if HAVE_ALIGNED_ALLOC | ||
88 | buf = aligned_alloc(16, 160); | 94 | buf = aligned_alloc(16, 160); | ||
89 | printf("aligned_alloc: %p\n", buf); | 95 | printf("aligned_alloc: %p\n", buf); | ||
90 | free(buf); | 96 | free(buf); | ||
91 | #endif | 97 | #endif | ||
92 | 98 | | |||
93 | buf = valloc(32); | 99 | buf = valloc(32); | ||
Show All 16 Lines |