g_utf8_next_char() never returns NULL. Remove redundant checks.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2015-01-14 11:19:54 +03:00
parent 67f465209b
commit 5cbfc77d2c
4 changed files with 5 additions and 14 deletions

View File

@ -586,7 +586,6 @@ dview_get_utf (char *str, int *char_length, gboolean * result)
{
int res = -1;
gunichar ch;
gchar *next_ch = NULL;
int ch_len = 0;
*result = TRUE;
@ -603,6 +602,8 @@ dview_get_utf (char *str, int *char_length, gboolean * result)
ch = *str;
else
{
gchar *next_ch;
ch = res;
/* Calculate UTF-8 char length */
next_ch = g_utf8_next_char (str);

View File

@ -255,13 +255,7 @@ edit_buffer_get_utf (const edit_buffer_t * buf, off_t byte_index, int *char_leng
ch = res;
/* Calculate UTF-8 char length */
next_ch = g_utf8_next_char (str);
if (next_ch != NULL)
*char_length = next_ch - str;
else
{
ch = 0;
*char_length = 0;
}
*char_length = next_ch - str;
}
return (int) ch;

View File

@ -252,8 +252,7 @@ line_pixel_length (unsigned char *t, off_t b, off_t l, gboolean utf8)
/* Calculate UTF-8 char length */
next_ch = g_utf8_next_char (tb);
if (next_ch != NULL)
char_length = next_ch - tb;
char_length = next_ch - tb;
if (g_unichar_iswide (ch))
x++;

View File

@ -213,10 +213,7 @@ mcview_get_utf (mcview_t * view, off_t byte_index, int *char_length, gboolean *
ch = res;
/* Calculate UTF-8 char length */
next_ch = g_utf8_next_char (str);
if (next_ch != NULL)
*char_length = next_ch - str;
else
return 0;
*char_length = next_ch - str;
}
*result = TRUE;
return ch;