summaryrefslogtreecommitdiff
path: root/tests/unistr/test-u-strtok.h
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2024-03-24 08:54:48 +0100
committerJörg Frings-Fürst <debian@jff.email>2024-03-24 08:54:48 +0100
commit163a663518f33bab48b28431972e580b366b4d49 (patch)
treef518ffabaca4a0b93f0103d617e803792d3b0b43 /tests/unistr/test-u-strtok.h
parent1b3a8d5ad2ea2f099d514d9dd51ebf926a628076 (diff)
parentdd0000f7e25abe6c28d4329d324fd7fcab54094f (diff)
Merge branch 'release/debian/1.2-1'HEADdebian/1.2-1master
Diffstat (limited to 'tests/unistr/test-u-strtok.h')
-rw-r--r--tests/unistr/test-u-strtok.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/unistr/test-u-strtok.h b/tests/unistr/test-u-strtok.h
index 15389ac1..74272d3b 100644
--- a/tests/unistr/test-u-strtok.h
+++ b/tests/unistr/test-u-strtok.h
@@ -1,5 +1,5 @@
/* Test of uN_strtok() functions.
- Copyright (C) 2015-2022 Free Software Foundation, Inc.
+ Copyright (C) 2015-2024 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -50,10 +50,12 @@ test_u_strtok (void)
'A', 'B', 'C', 'D', 'A', 'B', 'C', 'D', 'A', 'B', 'D', 'E', 0
};
ucs4_t u_delim[] = { 0x3000, 0x3001, 0 };
- size_t input_len = 6 * SIZEOF (u_input);
- UNIT *input = (UNIT *) malloc (input_len);
- size_t delim_len = 6 * SIZEOF (u_delim);
- UNIT *delim = (UNIT *) malloc (delim_len);
+ /* Convert ucs4_t[] to UNIT[].
+ Every ucs4_t yields at most 4 / sizeof (UNIT) units. */
+ size_t input_len = SIZEOF (u_input) * (4 / sizeof (UNIT));
+ UNIT *input = (UNIT *) malloc (input_len * sizeof (UNIT));
+ size_t delim_len = SIZEOF (u_delim) * (4 / sizeof (UNIT));
+ UNIT *delim = (UNIT *) malloc (delim_len * sizeof (UNIT));
UNIT *state;
const UNIT *result;
UNIT *ptr, *first_ptr, *second_ptr;