eolian: use eina API
authorDaniel Kolesa <d.kolesa@samsung.com>
Wed, 2 Jul 2014 23:04:30 +0000 (00:04 +0100)
committerDaniel Kolesa <d.kolesa@samsung.com>
Wed, 2 Jul 2014 23:05:16 +0000 (00:05 +0100)
src/lib/eolian/eo_lexer.c

index d68e4e4..3a7162e 100644 (file)
@@ -8,29 +8,25 @@
 
 int _eo_lexer_log_dom = -1;
 
-static int
-get_nbytes(int c)
-{
-   if (c < 192) return 1;
-   if (c < 224) return 2;
-   if (c < 240) return 3;
-   return 4;
-}
-
 static int lastbytes = 0;
 
 static void
 next_char(Eo_Lexer *ls)
 {
    int nb;
+   Eina_Bool end = EINA_FALSE;
 
    if (ls->stream == ls->stream_end)
-     ls->current = '\0';
+     {
+        end = EINA_TRUE;
+        ls->current = '\0';
+     }
    else
      ls->current = *(ls->stream++);
 
    nb = lastbytes;
-   if (!nb) nb = get_nbytes(ls->current);
+   if (!nb && end) nb = 1;
+   if (!nb) eina_unicode_utf8_next_get(ls->stream - 1, &nb);
 
    if (nb == 1)
      {