(svn r21347) -Cleanup: remove an unused feature from strgen and remove some ifs where we already know the result

This commit is contained in:
yexo 2010-11-28 19:40:35 +00:00
parent 35af463046
commit d81d42bfc3

View File

@ -742,22 +742,20 @@ static void HandleString(char *str, bool master)
return; return;
} }
if (ent == NULL) { if (_strings[_next_string_id]) {
if (_strings[_next_string_id]) { strgen_error("String ID 0x%X for '%s' already in use by '%s'", _next_string_id, str, _strings[_next_string_id]->name);
strgen_error("String ID 0x%X for '%s' already in use by '%s'", _next_string_id, str, _strings[_next_string_id]->name); return;
return;
}
/* Allocate a new LangString */
ent = CallocT<LangString>(1);
_strings[_next_string_id] = ent;
ent->index = _next_string_id++;
ent->name = strdup(str);
ent->line = _cur_line;
HashAdd(str, ent);
} }
/* Allocate a new LangString */
ent = CallocT<LangString>(1);
_strings[_next_string_id] = ent;
ent->index = _next_string_id++;
ent->name = strdup(str);
ent->line = _cur_line;
HashAdd(str, ent);
ent->english = strdup(s); ent->english = strdup(s);
} else { } else {
if (ent == NULL) { if (ent == NULL) {
@ -770,27 +768,22 @@ static void HandleString(char *str, bool master)
return; return;
} }
if (s[0] == ':' && s[1] == '\0' && casep == NULL) { /* make sure that the commands match */
/* Special syntax :: means we should just inherit the master string */ if (!CheckCommandsMatch(s, ent->english, str)) return;
ent->translated = strdup(ent->english);
if (casep != NULL) {
Case *c = MallocT<Case>(1);
c->caseidx = ResolveCaseName(casep, strlen(casep));
c->string = strdup(s);
c->next = ent->translated_case;
ent->translated_case = c;
} else { } else {
/* make sure that the commands match */ ent->translated = strdup(s);
if (!CheckCommandsMatch(s, ent->english, str)) return; /* If the string was translated, use the line from the
* translated language so errors in the translated file
if (casep != NULL) { * are properly referenced to. */
Case *c = MallocT<Case>(1); ent->line = _cur_line;
c->caseidx = ResolveCaseName(casep, strlen(casep));
c->string = strdup(s);
c->next = ent->translated_case;
ent->translated_case = c;
} else {
ent->translated = strdup(s);
/* If the string was translated, use the line from the
* translated language so errors in the translated file
* are properly referenced to. */
ent->line = _cur_line;
}
} }
} }
} }