summaryrefslogtreecommitdiff
path: root/tests/aplwc_utf8.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/aplwc_utf8.c')
-rw-r--r--tests/aplwc_utf8.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/tests/aplwc_utf8.c b/tests/aplwc_utf8.c
index b950580..4f9f2a4 100644
--- a/tests/aplwc_utf8.c
+++ b/tests/aplwc_utf8.c
@@ -1,3 +1,5 @@
+#include <stdlib.h>
+#include <string.h>
#include <aplwc.h>
uint8_t bad1[] = {0xff,0};
@@ -14,12 +16,27 @@ uint8_t good3[] = {0xed,0x95,0x9c,0xea,0xb5,0xad,0xec,0x96,0xb4,0};
uint8_t good4[] = {0xe6,0x97,0xa5,0xe6,0x9c,0xac,0xe8,0xaa,0x9e,0};
uint8_t good5[] = {0xef,0xbb,0xbf,0xf0,0xa3,0x8e,0xb4,0};
+static void *
+my_alloc(size_t min, size_t max, size_t *actual)
+{
+ (void)max;
+
+ *actual = min;
+ return malloc(min);
+}
+
+static void
+my_dealloc(void *p)
+{
+ free(p);
+}
+
int
main(void)
{
- uint8_t data[64000];
struct aplwc *aplwc;
struct aplwc_line *line;
+ struct aplwc_fns fns;
enum aplwc_rc ret;
size_t i;
@@ -41,7 +58,11 @@ main(void)
good5
};
- ret = aplwc_new(&aplwc, data, sizeof(data));
+ memset(&fns, 0, sizeof(fns));
+ fns.alloc = my_alloc;
+ fns.dealloc = my_dealloc;
+
+ ret = aplwc_new(&aplwc, fns);
if(ret)
return 1;