From 4c45d7699611436351468c65095e2ce4e4a812cd Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Wed, 13 Jul 2011 17:13:47 +0400 Subject: [PATCH] =?UTF-8?q?=D1=82=D0=B5=D1=81=D1=82=D1=8B=20xalloc,=20zall?= =?UTF-8?q?oc,=20zalloc=5Fext?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- c/xalloc/xalloc_test.c | 2 ++ c/zalloc/zalloc_test.c | 4 +++- c/zalloc_ext/zalloc_ext_test.c | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/c/xalloc/xalloc_test.c b/c/xalloc/xalloc_test.c index f7921a5..1fab1e4 100644 --- a/c/xalloc/xalloc_test.c +++ b/c/xalloc/xalloc_test.c @@ -41,6 +41,8 @@ int main(int argc, char *argv[]) p[i] = NULL; } + xclear(&p); + printf("Success, iterations = %lu, nobj = %lu\n", iterations, nobj); return EXIT_SUCCESS; diff --git a/c/zalloc/zalloc_test.c b/c/zalloc/zalloc_test.c index 2da738b..65828c1 100644 --- a/c/zalloc/zalloc_test.c +++ b/c/zalloc/zalloc_test.c @@ -28,7 +28,7 @@ int main(int argc, char *argv[]) for (i = 0; i < iterations; i++) { idx = (size_t)(rand() % (int)nobj); sz = i; - p[idx] = zrealloc(p[idx], sz); + zrealloc_inplace(&p[idx], sz); if (sz && !p[idx]) { fprintf(stderr, "Alloc error at i = %lu\n", i); @@ -39,6 +39,8 @@ int main(int argc, char *argv[]) for (i = 0; i < nobj; i++) zclear(&p[i]); + zclear(&p); + printf("Success, iterations = %lu, nobj = %lu\n", iterations, nobj); return EXIT_SUCCESS; diff --git a/c/zalloc_ext/zalloc_ext_test.c b/c/zalloc_ext/zalloc_ext_test.c index 88097d2..2bb5b6a 100644 --- a/c/zalloc_ext/zalloc_ext_test.c +++ b/c/zalloc_ext/zalloc_ext_test.c @@ -35,6 +35,8 @@ int main() zptr4_str = zalloc_append32_str(zptr4_str, (((((('4' << 8) + '4') << 8) + '4') << 8) + '4')); puts(zptr4_str); zptr3 = zalloc_append64(zptr3, 3232423423423LLU); + zptr = zalloc_append_ptr(zptr, (void *)93842); + int64_t i64 = 1561; int i; for (i = 0; i < 8; i++) @@ -70,6 +72,7 @@ int main() zptr5 = zalloc_insert64(zptr5, 9874, 5478433443LU); zptr6_str = zalloc_insert64_str(zptr6_str, zalloc_size(zptr6_str) - 1, i64); puts(zptr6_str); + zptr = zalloc_insert_ptr(zptr, 8, (void *)93842); return EXIT_SUCCESS; }