transliteration: drop syllable chain when not needed
This commit is contained in:
parent
abffd96948
commit
8c4061e171
3 changed files with 16 additions and 1 deletions
11
syllable.c
11
syllable.c
|
@ -69,3 +69,14 @@ char *syllable_chain_to_string(struct syllable *head)
|
||||||
|
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void syllable_chain_drop(struct syllable *head)
|
||||||
|
{
|
||||||
|
struct syllable *walk = head, *next;
|
||||||
|
|
||||||
|
while (walk) {
|
||||||
|
next = walk->next;
|
||||||
|
syllable_drop(walk);
|
||||||
|
walk = next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -17,5 +17,6 @@ struct syllable *syllable_append(struct syllable *tail, const char *data);
|
||||||
|
|
||||||
unsigned int syllable_chain_length(struct syllable *head);
|
unsigned int syllable_chain_length(struct syllable *head);
|
||||||
char *syllable_chain_to_string(struct syllable *head);
|
char *syllable_chain_to_string(struct syllable *head);
|
||||||
|
void syllable_chain_drop(struct syllable *head);
|
||||||
|
|
||||||
#endif /* __SYLLABE_H */
|
#endif /* __SYLLABE_H */
|
||||||
|
|
|
@ -85,7 +85,10 @@ char *transliterate_devanagari_to_latin(const char *text,
|
||||||
|
|
||||||
apply_transliteration_filters(head, context->filters);
|
apply_transliteration_filters(head, context->filters);
|
||||||
|
|
||||||
return syllable_chain_to_string(head);
|
tmp = syllable_chain_to_string(head);
|
||||||
|
syllable_chain_drop(head);
|
||||||
|
|
||||||
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void transliteration_context_drop(struct transliteration_context *context)
|
void transliteration_context_drop(struct transliteration_context *context)
|
||||||
|
|
Loading…
Reference in a new issue