seoz pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=13d1e5dcf0cacf537bbdaf56e2d9418b0d075211

commit 13d1e5dcf0cacf537bbdaf56e2d9418b0d075211
Author: Daniel Juyung Seo <[email protected]>
Date:   Tue Mar 4 00:01:48 2014 +0900

    eina_list: Optimize eina_list_nth() call in case of index 0.
    
    Check null and return the list data directly if the index 'n' is 0.
---
 src/lib/eina/eina_list.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/lib/eina/eina_list.c b/src/lib/eina/eina_list.c
index aa19ca4..fd5d672 100644
--- a/src/lib/eina/eina_list.c
+++ b/src/lib/eina/eina_list.c
@@ -927,6 +927,9 @@ EAPI void *
 eina_list_nth(const Eina_List *list, unsigned int n)
 {
    Eina_List *l;
+   if (!list) return NULL;
+
+   if (n == 0) return list->data;
 
    l = eina_list_nth_list(list, n);
    return l ? l->data : NULL;

-- 


Reply via email to