From d78fc418ece0e078f3fc9391dd33015bd647f135 Mon Sep 17 00:00:00 2001 From: "Andrew V. Samoilov" Date: Thu, 18 Jan 2018 22:53:25 +0200 Subject: [PATCH] (get_codepage_index): minor optimizations. Signed-off-by: Andrew V. Samoilov --- lib/charsets.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/charsets.c b/lib/charsets.c index 3c40e2ac6..da8c73238 100644 --- a/lib/charsets.c +++ b/lib/charsets.c @@ -245,10 +245,11 @@ int get_codepage_index (const char *id) { size_t i; - if (strcmp (id, OTHER_8BIT) == 0) - return -1; + if (codepages == NULL) return -1; + if (strcmp (id, OTHER_8BIT) == 0) + return -1; for (i = 0; i < codepages->len; i++) if (strcmp (id, ((codepage_desc *) g_ptr_array_index (codepages, i))->id) == 0) return i; @@ -292,8 +293,8 @@ init_translation_table (int cpsource, int cpdisplay) { conv_displ[i] = i; conv_input[i] = i; - cp_source = cp_display; } + cp_source = cp_display; return NULL; } -- 2.11.4.GIT