summaryrefslogtreecommitdiff
path: root/src/lib/elementary
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2021-05-03 18:48:24 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2021-05-03 18:48:24 +0100
commitde296b13c80b3d46b39265122b8da01cddfa5a6d (patch)
treeb38d9781b34a97da6e81a2c1cbe4dcd76d3d8a4c /src/lib/elementary
parent84e907ef7df6306eddf866bad9a500dde856117e (diff)
Eina: use eina_fnmatch() instead of fnmatch()
Reviewers: raster Reviewed By: raster Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D12262
Diffstat (limited to '')
-rw-r--r--src/lib/elementary/Efl_Ui.h1
-rw-r--r--src/lib/elementary/Elementary.h1
-rw-r--r--src/lib/elementary/elm_gengrid.c18
-rw-r--r--src/lib/elementary/elm_genlist.c20
4 files changed, 16 insertions, 24 deletions
diff --git a/src/lib/elementary/Efl_Ui.h b/src/lib/elementary/Efl_Ui.h
index 3a64e9fdb0..3178aa9be6 100644
--- a/src/lib/elementary/Efl_Ui.h
+++ b/src/lib/elementary/Efl_Ui.h
@@ -14,7 +14,6 @@
14#include <sys/time.h> 14#include <sys/time.h>
15#include <sys/param.h> 15#include <sys/param.h>
16#include <math.h> 16#include <math.h>
17#include <fnmatch.h>
18#include <limits.h> 17#include <limits.h>
19#include <ctype.h> 18#include <ctype.h>
20#include <time.h> 19#include <time.h>
diff --git a/src/lib/elementary/Elementary.h b/src/lib/elementary/Elementary.h
index 8e8c198829..b26272c128 100644
--- a/src/lib/elementary/Elementary.h
+++ b/src/lib/elementary/Elementary.h
@@ -20,7 +20,6 @@
20#include <sys/time.h> 20#include <sys/time.h>
21#include <sys/param.h> 21#include <sys/param.h>
22#include <math.h> 22#include <math.h>
23#include <fnmatch.h>
24#include <limits.h> 23#include <limits.h>
25#include <ctype.h> 24#include <ctype.h>
26#include <time.h> 25#include <time.h>
diff --git a/src/lib/elementary/elm_gengrid.c b/src/lib/elementary/elm_gengrid.c
index 132b7aa14f..07e9a971ec 100644
--- a/src/lib/elementary/elm_gengrid.c
+++ b/src/lib/elementary/elm_gengrid.c
@@ -418,12 +418,10 @@ _elm_gengrid_search_by_text_item_get(Eo *obj EINA_UNUSED,
418 if (!pattern) return NULL; 418 if (!pattern) return NULL;
419 if (!sd->items) return NULL; 419 if (!sd->items) return NULL;
420 420
421 if (flags & ELM_GLOB_MATCH_NO_ESCAPE) fnflags |= FNM_NOESCAPE; 421 if (flags & ELM_GLOB_MATCH_NO_ESCAPE) fnflags |= EINA_FNMATCH_NOESCAPE;
422 if (flags & ELM_GLOB_MATCH_PATH) fnflags |= FNM_PATHNAME; 422 if (flags & ELM_GLOB_MATCH_PATH) fnflags |= EINA_FNMATCH_PATHNAME;
423 if (flags & ELM_GLOB_MATCH_PERIOD) fnflags |= FNM_PERIOD; 423 if (flags & ELM_GLOB_MATCH_PERIOD) fnflags |= EINA_FNMATCH_PERIOD;
424#ifdef FNM_CASEFOLD 424 if (flags & ELM_GLOB_MATCH_NOCASE) fnflags |= EINA_FNMATCH_CASEFOLD;
425 if (flags & ELM_GLOB_MATCH_NOCASE) fnflags |= FNM_CASEFOLD;
426#endif
427 425
428 ELM_GENGRID_ITEM_DATA_GET(eo_item_to_search_from, item_to_search_from); 426 ELM_GENGRID_ITEM_DATA_GET(eo_item_to_search_from, item_to_search_from);
429 start = (item_to_search_from) ? 427 start = (item_to_search_from) ?
@@ -435,7 +433,7 @@ _elm_gengrid_search_by_text_item_get(Eo *obj EINA_UNUSED,
435 str = it->itc->func.text_get((void *)WIDGET_ITEM_DATA_GET(EO_OBJ(it)), 433 str = it->itc->func.text_get((void *)WIDGET_ITEM_DATA_GET(EO_OBJ(it)),
436 WIDGET(it), part_name ? part_name : "elm.text"); 434 WIDGET(it), part_name ? part_name : "elm.text");
437 if (!str) continue; 435 if (!str) continue;
438 if (!fnmatch(pattern, str, fnflags)) 436 if (eina_fnmatch(pattern, str, fnflags))
439 { 437 {
440 free(str); 438 free(str);
441 return EO_OBJ(it); 439 return EO_OBJ(it);
@@ -1021,7 +1019,7 @@ _item_text_realize(Elm_Gen_Item *it,
1021 (edje_object_data_get(target, "texts")); 1019 (edje_object_data_get(target, "texts"));
1022 EINA_LIST_FOREACH(*source, l, key) 1020 EINA_LIST_FOREACH(*source, l, key)
1023 { 1021 {
1024 if (parts && fnmatch(parts, key, FNM_PERIOD)) continue; 1022 if (parts && !eina_fnmatch(parts, key, EINA_FNMATCH_PERIOD)) continue;
1025 1023
1026 s = it->itc->func.text_get 1024 s = it->itc->func.text_get
1027 ((void *)WIDGET_ITEM_DATA_GET(EO_OBJ(it)), WIDGET(it), key); 1025 ((void *)WIDGET_ITEM_DATA_GET(EO_OBJ(it)), WIDGET(it), key);
@@ -1070,7 +1068,7 @@ _item_content_realize(Elm_Gen_Item *it,
1070 1068
1071 EINA_LIST_FREE(source, key) 1069 EINA_LIST_FREE(source, key)
1072 { 1070 {
1073 if (parts && fnmatch(parts, key, FNM_PERIOD)) 1071 if (parts && !eina_fnmatch(parts, key, EINA_FNMATCH_PERIOD))
1074 continue; 1072 continue;
1075 1073
1076 Evas_Object *old = edje_object_part_swallow_get(target, key); 1074 Evas_Object *old = edje_object_part_swallow_get(target, key);
@@ -1137,7 +1135,7 @@ _item_state_realize(Elm_Gen_Item *it, Evas_Object *target, const char *parts)
1137 src = elm_widget_stringlist_get(edje_object_data_get(target, "states")); 1135 src = elm_widget_stringlist_get(edje_object_data_get(target, "states"));
1138 EINA_LIST_FREE(src, key) 1136 EINA_LIST_FREE(src, key)
1139 { 1137 {
1140 if (parts && fnmatch(parts, key, FNM_PERIOD)) continue; 1138 if (parts && !eina_fnmatch(parts, key, EINA_FNMATCH_PERIOD)) continue;
1141 1139
1142 Eina_Bool on = it->itc->func.state_get 1140 Eina_Bool on = it->itc->func.state_get
1143 ((void *)WIDGET_ITEM_DATA_GET(EO_OBJ(it)), WIDGET(it), key); 1141 ((void *)WIDGET_ITEM_DATA_GET(EO_OBJ(it)), WIDGET(it), key);
diff --git a/src/lib/elementary/elm_genlist.c b/src/lib/elementary/elm_genlist.c
index 78b3134138..d7ed1e52e0 100644
--- a/src/lib/elementary/elm_genlist.c
+++ b/src/lib/elementary/elm_genlist.c
@@ -2,8 +2,6 @@
2# include "elementary_config.h" 2# include "elementary_config.h"
3#endif 3#endif
4 4
5#include <fnmatch.h>
6
7#define EFL_ACCESS_OBJECT_PROTECTED 5#define EFL_ACCESS_OBJECT_PROTECTED
8#define EFL_ACCESS_SELECTION_PROTECTED 6#define EFL_ACCESS_SELECTION_PROTECTED
9#define EFL_ACCESS_WIDGET_ACTION_PROTECTED 7#define EFL_ACCESS_WIDGET_ACTION_PROTECTED
@@ -347,7 +345,7 @@ _item_text_realize(Elm_Gen_Item *it,
347 (edje_object_data_get(target, "texts")); 345 (edje_object_data_get(target, "texts"));
348 EINA_LIST_FOREACH(*source, l, key) 346 EINA_LIST_FOREACH(*source, l, key)
349 { 347 {
350 if (parts && fnmatch(parts, key, FNM_PERIOD)) continue; 348 if (parts && !eina_fnmatch(parts, key, EINA_FNMATCH_PERIOD)) continue;
351 349
352 s = it->itc->func.text_get 350 s = it->itc->func.text_get
353 ((void *)WIDGET_ITEM_DATA_GET(EO_OBJ(it)), WIDGET(it), key); 351 ((void *)WIDGET_ITEM_DATA_GET(EO_OBJ(it)), WIDGET(it), key);
@@ -423,7 +421,7 @@ _item_content_realize(Elm_Gen_Item *it,
423 421
424 EINA_LIST_FREE(source, key) 422 EINA_LIST_FREE(source, key)
425 { 423 {
426 if (parts && fnmatch(parts, key, FNM_PERIOD)) 424 if (parts && !eina_fnmatch(parts, key, EINA_FNMATCH_PERIOD))
427 continue; 425 continue;
428 426
429 Evas_Object *old = NULL; 427 Evas_Object *old = NULL;
@@ -505,7 +503,7 @@ _item_state_realize(Elm_Gen_Item *it, Evas_Object *target, const char *parts)
505 src = elm_widget_stringlist_get(edje_object_data_get(target, "states")); 503 src = elm_widget_stringlist_get(edje_object_data_get(target, "states"));
506 EINA_LIST_FREE(src, key) 504 EINA_LIST_FREE(src, key)
507 { 505 {
508 if (parts && fnmatch(parts, key, FNM_PERIOD)) continue; 506 if (parts && !eina_fnmatch(parts, key, EINA_FNMATCH_PERIOD)) continue;
509 507
510 Eina_Bool on = it->itc->func.state_get 508 Eina_Bool on = it->itc->func.state_get
511 ((void *)WIDGET_ITEM_DATA_GET(EO_OBJ(it)), WIDGET(it), key); 509 ((void *)WIDGET_ITEM_DATA_GET(EO_OBJ(it)), WIDGET(it), key);
@@ -8746,12 +8744,10 @@ _elm_genlist_search_by_text_item_get(Eo *obj EINA_UNUSED,
8746 if (!pattern) return NULL; 8744 if (!pattern) return NULL;
8747 if (!sd->items) return NULL; 8745 if (!sd->items) return NULL;
8748 8746
8749 if (flags & ELM_GLOB_MATCH_NO_ESCAPE) fnflags |= FNM_NOESCAPE; 8747 if (flags & ELM_GLOB_MATCH_NO_ESCAPE) fnflags |= EINA_FNMATCH_NOESCAPE;
8750 if (flags & ELM_GLOB_MATCH_PATH) fnflags |= FNM_PATHNAME; 8748 if (flags & ELM_GLOB_MATCH_PATH) fnflags |= EINA_FNMATCH_PATHNAME;
8751 if (flags & ELM_GLOB_MATCH_PERIOD) fnflags |= FNM_PERIOD; 8749 if (flags & ELM_GLOB_MATCH_PERIOD) fnflags |= EINA_FNMATCH_PERIOD;
8752#ifdef FNM_CASEFOLD 8750 if (flags & ELM_GLOB_MATCH_NOCASE) fnflags |= EINA_FNMATCH_CASEFOLD;
8753 if (flags & ELM_GLOB_MATCH_NOCASE) fnflags |= FNM_CASEFOLD;
8754#endif
8755 8751
8756 start = (item_to_search_from) ? 8752 start = (item_to_search_from) ?
8757 EINA_INLIST_GET((Elm_Gen_Item *)efl_data_scope_get(item_to_search_from, ELM_GENLIST_ITEM_CLASS)) : 8753 EINA_INLIST_GET((Elm_Gen_Item *)efl_data_scope_get(item_to_search_from, ELM_GENLIST_ITEM_CLASS)) :
@@ -8761,7 +8757,7 @@ _elm_genlist_search_by_text_item_get(Eo *obj EINA_UNUSED,
8761 if (!it->itc->func.text_get) continue; 8757 if (!it->itc->func.text_get) continue;
8762 str = it->itc->func.text_get((void *)WIDGET_ITEM_DATA_GET(EO_OBJ(it)), WIDGET(it), part_name); 8758 str = it->itc->func.text_get((void *)WIDGET_ITEM_DATA_GET(EO_OBJ(it)), WIDGET(it), part_name);
8763 if (!str) continue; 8759 if (!str) continue;
8764 if (!fnmatch(pattern, str, fnflags)) 8760 if (eina_fnmatch(pattern, str, fnflags))
8765 { 8761 {
8766 free(str); 8762 free(str);
8767 return EO_OBJ(it); 8763 return EO_OBJ(it);