From 470e6d8d2f6b84c9956370237e56ed5d7127cfc7 Mon Sep 17 00:00:00 2001 From: Vlasta Vesely Date: Mon, 30 Apr 2018 18:51:50 +0200 Subject: [PATCH] iast-czech: remove ending '-m' suffix --- iast-czech.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/iast-czech.c b/iast-czech.c index 06e67c9..fa5c78d 100644 --- a/iast-czech.c +++ b/iast-czech.c @@ -4,6 +4,7 @@ #include #include +#include #include "iast-czech.h" #include "transliteration.h" @@ -133,8 +134,25 @@ static void nasal_consonants_filter(struct syllable *chain) } } +static void end_of_word_filter(struct syllable *chain) +{ + struct syllable *syllable = chain; + + while (syllable) { + if (syllable->next == NULL || isspace(syllable->next->data[0])) { + if (!strcmp(syllable->data, "m")) { + free(syllable->data); + syllable->data = strdup(""); + } + } + + syllable = syllable->next; + } +} + static const transliteration_filter_t filters[] = { nasal_consonants_filter, + end_of_word_filter, NULL };