granularity_read: type correction and optimization in _valid_character_check() 99/283299/1 accepted/tizen/6.5/unified/20221109.213852 submit/tizen_6.5/20221109.043059
authorMaria Bialota <m.bialota@samsung.com>
Fri, 21 Oct 2022 10:44:13 +0000 (12:44 +0200)
committerMaria Białota <m.bialota@samsung.com>
Fri, 21 Oct 2022 13:02:06 +0000 (13:02 +0000)
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 0fa998ef3cef894f24dbc339e2dc5a07b6d1dabb..7106b7b027375a71d51470380d052cf3e30b0d16 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");