diff options
-rw-r--r-- | src/ellinika/elmorph.c | 1 | ||||
-rw-r--r-- | src/ellinika/syllabificator.c | 23 |
2 files changed, 12 insertions, 12 deletions
diff --git a/src/ellinika/elmorph.c b/src/ellinika/elmorph.c index 90a156d..a06d43b 100644 --- a/src/ellinika/elmorph.c +++ b/src/ellinika/elmorph.c | |||
@@ -980,7 +980,6 @@ SCM_DEFINE_PUBLIC(scm_elstr__phonetic_map, "elstr->phonetic-map", | |||
980 | tail = elt; | 980 | tail = elt; |
981 | } | 981 | } |
982 | } | 982 | } |
983 | free(phmap); | ||
984 | return head; | 983 | return head; |
985 | } | 984 | } |
986 | #undef FUNC_NAME | 985 | #undef FUNC_NAME |
diff --git a/src/ellinika/syllabificator.c b/src/ellinika/syllabificator.c index 97d3ce7..0e7b6c6 100644 --- a/src/ellinika/syllabificator.c +++ b/src/ellinika/syllabificator.c | |||
@@ -38,7 +38,13 @@ struct syllabificator { | |||
38 | ((ph).code == PHON_I && (ph).count == 1 && \ | 38 | ((ph).code == PHON_I && (ph).count == 1 && \ |
39 | !((ph).flags & (CHF_ACCENT_MASK|CHF_TREMA))) | 39 | !((ph).flags & (CHF_ACCENT_MASK|CHF_TREMA))) |
40 | 40 | ||
41 | int | 41 | #define NEXT_PHONEME(sp) do { \ |
42 | (sp)->phon_cur++; \ | ||
43 | if ((sp)->phon_cur == (sp)->phon_max) \ | ||
44 | return 0; \ | ||
45 | } while (0) | ||
46 | |||
47 | static int | ||
42 | next_syllable(struct syllabificator *sp) | 48 | next_syllable(struct syllabificator *sp) |
43 | { | 49 | { |
44 | struct syllable *syl; | 50 | struct syllable *syl; |
@@ -65,8 +71,8 @@ next_syllable(struct syllabificator *sp) | |||
65 | syl->phoneme_start = sp->phon_cur; | 71 | syl->phoneme_start = sp->phon_cur; |
66 | syl->phoneme_count = 1; | 72 | syl->phoneme_count = 1; |
67 | syl->flags = sp->phon[sp->phon_cur].flags; | 73 | syl->flags = sp->phon[sp->phon_cur].flags; |
68 | 74 | ||
69 | sp->phon_cur++; | 75 | NEXT_PHONEME(sp); |
70 | 76 | ||
71 | /* A diphthong forms a single syllable. */ | 77 | /* A diphthong forms a single syllable. */ |
72 | if ((syl->flags & CHF_DIPHTHONG) && !(syl->flags & CHF_CONSONANT)) | 78 | if ((syl->flags & CHF_DIPHTHONG) && !(syl->flags & CHF_CONSONANT)) |
@@ -93,9 +99,7 @@ next_syllable(struct syllabificator *sp) | |||
93 | /* incorporate iota */; | 99 | /* incorporate iota */; |
94 | syl->char_count += sp->phon[sp->phon_cur].count; | 100 | syl->char_count += sp->phon[sp->phon_cur].count; |
95 | syl->phoneme_count++; | 101 | syl->phoneme_count++; |
96 | sp->phon_cur++; | 102 | NEXT_PHONEME(sp); |
97 | if (sp->phon_cur == sp->phon_max) | ||
98 | return 0; | ||
99 | if (sp->phon[sp->phon_cur].flags & CHF_VOWEL) | 103 | if (sp->phon[sp->phon_cur].flags & CHF_VOWEL) |
100 | syl->flags |= CHF_DIPHTHONG|CHF_IOTA; | 104 | syl->flags |= CHF_DIPHTHONG|CHF_IOTA; |
101 | } | 105 | } |
@@ -105,10 +109,7 @@ next_syllable(struct syllabificator *sp) | |||
105 | 109 | ||
106 | syl->char_count += sp->phon[sp->phon_cur].count; | 110 | syl->char_count += sp->phon[sp->phon_cur].count; |
107 | syl->phoneme_count++; | 111 | syl->phoneme_count++; |
108 | sp->phon_cur++; | 112 | NEXT_PHONEME(sp); |
109 | |||
110 | if (sp->phon_cur == sp->phon_max) | ||
111 | return 0; | ||
112 | 113 | ||
113 | if (sp->phon[sp->phon_cur - 1].flags & CHF_VOWEL) { | 114 | if (sp->phon[sp->phon_cur - 1].flags & CHF_VOWEL) { |
114 | /* If next phoneme is a consonant, incorporate it into the | 115 | /* If next phoneme is a consonant, incorporate it into the |
@@ -118,7 +119,7 @@ next_syllable(struct syllabificator *sp) | |||
118 | (sp->phon[sp->phon_cur + 1].flags & CHF_CONSONANT))) { | 119 | (sp->phon[sp->phon_cur + 1].flags & CHF_CONSONANT))) { |
119 | syl->char_count += sp->phon[sp->phon_cur].count; | 120 | syl->char_count += sp->phon[sp->phon_cur].count; |
120 | syl->phoneme_count++; | 121 | syl->phoneme_count++; |
121 | sp->phon_cur++; | 122 | NEXT_PHONEME(sp); |
122 | } | 123 | } |
123 | } | 124 | } |
124 | 125 | ||