This commit is contained in:
Vlasta Vesely 2018-05-16 14:58:47 +02:00
parent 02145edffc
commit abffd96948
2 changed files with 9 additions and 5 deletions

7
main.c
View file

@ -62,10 +62,9 @@ int main(int argc, const char **argv)
} }
} }
if (flags & FLAG_CZECH) context = (flags & FLAG_CZECH)
context = transliteration_context_iast_czech_alloc(); ? transliteration_context_iast_czech_alloc()
else : transliteration_context_iast_alloc();
context = transliteration_context_iast_alloc();
if (flags & FLAG_STDIN) { if (flags & FLAG_STDIN) {
input = stdin_read(); input = stdin_read();

View file

@ -10,18 +10,23 @@ struct syllable *syllable_alloc(const char *data)
struct syllable *ptr = malloc(sizeof(*ptr)); struct syllable *ptr = malloc(sizeof(*ptr));
if (ptr == NULL) if (ptr == NULL)
return NULL; goto out;
ptr->data = strdup(data); ptr->data = strdup(data);
ptr->code = 0; ptr->code = 0;
ptr->prev = NULL; ptr->prev = NULL;
ptr->next = NULL; ptr->next = NULL;
out:
return ptr; return ptr;
} }
void syllable_drop(struct syllable *ptr) void syllable_drop(struct syllable *ptr)
{ {
if (ptr == NULL)
return;
free(ptr->data);
free(ptr); free(ptr);
} }