(get_codepage_index): minor optimizations.

Signed-off-by: Andrew V. Samoilov <a.samoilov@gmail.com>
This commit is contained in:
Andrew V. Samoilov 2018-01-18 22:53:25 +02:00 committed by Andrew Borodin
parent 56081caaae
commit d78fc418ec

View File

@ -245,10 +245,11 @@ int
get_codepage_index (const char *id) get_codepage_index (const char *id)
{ {
size_t i; size_t i;
if (strcmp (id, OTHER_8BIT) == 0)
return -1;
if (codepages == NULL) if (codepages == NULL)
return -1; return -1;
if (strcmp (id, OTHER_8BIT) == 0)
return -1;
for (i = 0; i < codepages->len; i++) for (i = 0; i < codepages->len; i++)
if (strcmp (id, ((codepage_desc *) g_ptr_array_index (codepages, i))->id) == 0) if (strcmp (id, ((codepage_desc *) g_ptr_array_index (codepages, i))->id) == 0)
return i; return i;
@ -292,8 +293,8 @@ init_translation_table (int cpsource, int cpdisplay)
{ {
conv_displ[i] = i; conv_displ[i] = i;
conv_input[i] = i; conv_input[i] = i;
cp_source = cp_display;
} }
cp_source = cp_display;
return NULL; return NULL;
} }