granularity_read: type correction and optimization in _valid_character_check() 85/283285/2 accepted/tizen/unified/20221102.020533
authorMaria Bialota <m.bialota@samsung.com>
Fri, 21 Oct 2022 10:44:13 +0000 (12:44 +0200)
committerMaria Bialota <m.bialota@samsung.com>
Fri, 21 Oct 2022 10:52:48 +0000 (12:52 +0200)
Corrected variable types and in _valid_character_check() function
and optimized number of strlen() calls in the function

Change-Id: I98dd720ea5d650bd5ffdec348cacfc04b1653423

src/granularity_read.c

index dd1380d1c6506589f798405aa0ad95794165a6f4..959845022a3a55931a5f88c6b39ccf811f9dadba 100644 (file)
@@ -46,12 +46,15 @@ static char *_read_character_next_get(char *str, int *start_cursor, int *end_cur
 static Eina_Bool _valid_character_check(char *text, const char *check_buf)
 {
        DEBUG("START");
-       int i = 0;
-       int j = 0;
+
        if (!text)
                return EINA_FALSE;
-       for (i = 0; i < strlen(check_buf); i++)
-               for (j = 0; j < strlen(text); j++)
+
+       size_t check_buf_len = strlen(check_buf);
+       size_t text_len = strlen(text);
+
+       for (size_t i = 0; i < check_buf_len; i++)
+               for (size_t j = 0; j < text_len; j++)
                        if (text[j] == check_buf[i])
                                return EINA_FALSE;
        DEBUG("END");