summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyuan Choi <ryuan.choi@gmail.com>2014-02-07 01:11:58 +0900
committerRyuan Choi <ryuan.choi@gmail.com>2014-02-07 01:17:44 +0900
commit388829387e4fccbb8187abbd5c14220ef9496a8e (patch)
tree5fc5ce08007064780343b2db401a336b3de84a51
parentf1730bdff9405995a2b9d920015dacd595290be2 (diff)
datetime: Simplify the nested loop in _datetime_items_get()
-rw-r--r--src/lib/elm_datetime.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/lib/elm_datetime.c b/src/lib/elm_datetime.c
index d0f96183a..9beadf7ef 100644
--- a/src/lib/elm_datetime.c
+++ b/src/lib/elm_datetime.c
@@ -389,26 +389,22 @@ _datetime_items_get(const Evas_Object *obj)
389{ 389{
390 Eina_List *items = NULL; 390 Eina_List *items = NULL;
391 Datetime_Field *field; 391 Datetime_Field *field;
392 int loc = 0;
393 unsigned int idx; 392 unsigned int idx;
394 Eina_Bool visible[ELM_DATETIME_TYPE_COUNT]; 393 Datetime_Field *sorted_fields[ELM_DATETIME_TYPE_COUNT];
395 394
396 ELM_DATETIME_DATA_GET(obj, sd); 395 ELM_DATETIME_DATA_GET(obj, sd);
397 396
398 for (idx = 0; idx < ELM_DATETIME_TYPE_COUNT; idx++) 397 for (idx = 0; idx < ELM_DATETIME_TYPE_COUNT; idx++)
399 { 398 {
400 field = sd->field_list + idx; 399 field = sd->field_list + idx;
401 if (field->fmt_exist && field->visible) visible[idx] = EINA_TRUE; 400 sorted_fields[field->location] = field;
402 else visible[idx] = EINA_FALSE;
403 } 401 }
404 for (loc = 0; loc < ELM_DATETIME_TYPE_COUNT; loc++) 402
403 for (idx = 0; idx < ELM_DATETIME_TYPE_COUNT; idx++)
405 { 404 {
406 for (idx = 0; idx < ELM_DATETIME_TYPE_COUNT; idx++) 405 field = sorted_fields + idx;
407 { 406 if (field->fmt_exist && field->visible)
408 field = sd->field_list + idx; 407 items = eina_list_append(items, field->item_obj);
409 if ((field->location == loc) && (visible[idx]))
410 items = eina_list_append(items, field->item_obj);
411 }
412 } 408 }
413 409
414 // ACCESS 410 // ACCESS