summaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-04-21 13:47:04 +0200
committerChristian Grothoff <christian@grothoff.org>2020-04-21 13:47:04 +0200
commit13ceb583b892ecbe1094e473c058a6ff18ad0efb (patch)
treeb11e8b3bfea52a94d77d948b169a031dc8378228 /src/util
parent3776e3a77bff3f3d7091e91aac2e1b6b3425b28d (diff)
defining GNUNET_array_concatenate() for #6190
Diffstat (limited to 'src/util')
-rw-r--r--src/util/test_common_allocation.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/util/test_common_allocation.c b/src/util/test_common_allocation.c
index e2fc29e82..a24af7124 100644
--- a/src/util/test_common_allocation.c
+++ b/src/util/test_common_allocation.c
@@ -27,7 +27,7 @@
static int
-check ()
+check (void)
{
#define MAX_TESTVAL 1024
char *ptrs[MAX_TESTVAL];
@@ -134,6 +134,28 @@ check ()
}
+static int
+check2 (void)
+{
+ char *a1 = NULL;
+ unsigned int a1_len = 0;
+ const char *a2 = "test";
+
+ GNUNET_array_append (a1,
+ a1_len,
+ 'x');
+ GNUNET_array_concatenate (a1,
+ a1_len,
+ a2,
+ 4);
+ GNUNET_assert (0 == strncmp ("xtest",
+ a1,
+ 5));
+ GNUNET_assert (5 == a1_len);
+ return 0;
+}
+
+
int
main (int argc, char *argv[])
{
@@ -142,7 +164,7 @@ main (int argc, char *argv[])
GNUNET_log_setup ("test-common-allocation",
"WARNING",
NULL);
- ret = check ();
+ ret = check () | check2 ();
if (ret != 0)
fprintf (stderr,
"ERROR %d.\n",