void register_language_string(struct language *lang, char *ident, char *text) {
int cindex = get_entry_index(ident);
- struct language_table *lang_entry = malloc(sizeof(*lang_entry));
- if (!lang_entry) {
- perror("malloc() failed");
- return;
+ struct language_table *lang_entry;
+ for(lang_entry = lang->entrys[cindex]; lang_entry; lang_entry = lang_entry->next) {
+ if(!strcmp(lang_entry->ident, ident)) break;
+ }
+ if(!lang_entry) {
+ lang_entry = malloc(sizeof(*lang_entry));
+ if (!lang_entry) {
+ perror("malloc() failed");
+ return;
+ }
+ lang_entry->ident = strdup(ident);
}
-
- lang_entry->ident = strdup(ident);
//replace all:
//$b to \002
//$k to \003