From 1d21aa01696fc70d32833e5fff4cdda0ad75cb36 Mon Sep 17 00:00:00 2001 From: seleznevae Date: Fri, 31 Aug 2018 20:17:10 +0300 Subject: [PATCH] [C] Made wc functions internal --- lib/fort.c | 18 +++++++++++++++--- src/wcwidth.c | 9 +++++++-- src/wcwidth.h | 9 ++++++++- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/lib/fort.c b/lib/fort.c index 8711032..46977c8 100644 --- a/lib/fort.c +++ b/lib/fort.c @@ -246,10 +246,17 @@ extern fort_status_t vector_swap(vector_t *cur_vec, vector_t *mv_vec, size_t pos #ifndef WCWIDTH_H #define WCWIDTH_H +/* #include "fort_utils.h" */ /* Commented by amalgamation script */ +#ifdef FT_HAVE_WCHAR +#include + +FT_INTERNAL int mk_wcswidth(const wchar_t *pwcs, size_t n); -#endif // WCWIDTH_H +#endif /* FT_HAVE_WCHAR */ + +#endif /* WCWIDTH_H */ /******************************************************** End of file "wcwidth.h" @@ -4706,7 +4713,10 @@ clear: * Latest version: http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c */ -#include +/* #include "wcwidth.h" */ /* Commented by amalgamation script */ + +#ifdef FT_HAVE_WCHAR + struct interval { int first; @@ -4767,7 +4777,7 @@ static int bisearch(wchar_t ucs, const struct interval *table, int max) * in ISO 10646. */ -int mk_wcwidth(wchar_t ucs) +static int mk_wcwidth(wchar_t ucs) { /* sorted list of non-overlapping intervals of non-spacing characters */ /* generated by "uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B c" */ @@ -4852,6 +4862,7 @@ int mk_wcwidth(wchar_t ucs) } +FT_INTERNAL int mk_wcswidth(const wchar_t *pwcs, size_t n) { int w, width = 0; @@ -4864,6 +4875,7 @@ int mk_wcswidth(const wchar_t *pwcs, size_t n) return width; } +#endif /* FT_HAVE_WCHAR */ /******************************************************** End of file "wcwidth.c" diff --git a/src/wcwidth.c b/src/wcwidth.c index ca2582c..c82fa3b 100644 --- a/src/wcwidth.c +++ b/src/wcwidth.c @@ -59,7 +59,10 @@ * Latest version: http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c */ -#include +#include "wcwidth.h" + +#ifdef FT_HAVE_WCHAR + struct interval { int first; @@ -120,7 +123,7 @@ static int bisearch(wchar_t ucs, const struct interval *table, int max) * in ISO 10646. */ -int mk_wcwidth(wchar_t ucs) +static int mk_wcwidth(wchar_t ucs) { /* sorted list of non-overlapping intervals of non-spacing characters */ /* generated by "uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B c" */ @@ -205,6 +208,7 @@ int mk_wcwidth(wchar_t ucs) } +FT_INTERNAL int mk_wcswidth(const wchar_t *pwcs, size_t n) { int w, width = 0; @@ -217,3 +221,4 @@ int mk_wcswidth(const wchar_t *pwcs, size_t n) return width; } +#endif /* FT_HAVE_WCHAR */ diff --git a/src/wcwidth.h b/src/wcwidth.h index 17c6602..60433ad 100644 --- a/src/wcwidth.h +++ b/src/wcwidth.h @@ -1,7 +1,14 @@ #ifndef WCWIDTH_H #define WCWIDTH_H +#include "fort_utils.h" +#ifdef FT_HAVE_WCHAR +#include + +FT_INTERNAL int mk_wcswidth(const wchar_t *pwcs, size_t n); -#endif // WCWIDTH_H +#endif /* FT_HAVE_WCHAR */ + +#endif /* WCWIDTH_H */