utf8proc

A clean C library for processing UTF-8 Unicode data
git clone https://git.sinitax.com/juliastrings/utf8proc
Log | Files | Refs | README | LICENSE | sfeed.txt

commit 5f15b515e19576c42900b6de96beb12cc512d458
parent d588d7097c070c0fddd918573e562aa94e1fb26c
Author: Steven G. Johnson <stevenj@alum.mit.edu>
Date:   Sat, 28 Mar 2020 09:42:29 -0400

simplifications

Diffstat:
Mtest/graphemetest.c | 2--
Mtest/normtest.c | 1-
Dtest/simple_getline.h | 11-----------
Mtest/tests.c | 12++++++++++++
Mtest/tests.h | 1+
5 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/test/graphemetest.c b/test/graphemetest.c @@ -1,10 +1,8 @@ #include "tests.h" -#include "simple_getline.h" int main(int argc, char **argv) { char buf[8192]; - size_t bufsize = 0; FILE *f = argc > 1 ? fopen(argv[1], "r") : NULL; utf8proc_uint8_t src[1024]; int len; diff --git a/test/normtest.c b/test/normtest.c @@ -1,5 +1,4 @@ #include "tests.h" -#include "simple_getline.h" #define CHECK_NORM(NRM, norm, src) { \ char *src_norm = (char*) utf8proc_ ## NRM((utf8proc_uint8_t*) src); \ diff --git a/test/simple_getline.h b/test/simple_getline.h @@ -1,11 +0,0 @@ -/* simplistic, portable replacement for getline, sufficient for our tests */ -static size_t simple_getline(char buf[8192], FILE *f) { - size_t i = 0; - while (i < 1023) { - int c = getc(f); - if (c == EOF || c == '\n') break; - buf[i++] = (char) c; - } - buf[i] = 0; - return i; -} diff --git a/test/tests.c b/test/tests.c @@ -44,3 +44,15 @@ size_t encode(char *dest, const char *buf) d += utf8proc_encode_char(c, (utf8proc_uint8_t *) (dest + d)); } } + +/* simplistic, portable replacement for getline, sufficient for our tests */ +size_t simple_getline(char buf[8192], FILE *f) { + size_t i = 0; + while (i < 1023) { + int c = getc(f); + if (c == EOF || c == '\n') break; + buf[i++] = (char) c; + } + buf[i] = 0; + return i; +} diff --git a/test/tests.h b/test/tests.h @@ -21,3 +21,4 @@ extern size_t lineno; void check(int cond, const char *format, ...); size_t skipspaces(const char *buf, size_t i); size_t encode(char *dest, const char *buf); +size_t simple_getline(char buf[8192], FILE *f);