>From 2d1a6ec45e5ac3bb19732580a5ef09c870b5ffc0 Mon Sep 17 00:00:00 2001
From: Patryk Kaczmarek <patryk.k@samsung.com>
Date: Mon, 24 Sep 2012 16:55:13 +0200
Subject: [PATCH] Change in NULL checks order

Change-Id: I3e5e64a8e6f1de1760912b2be2c43f339ab14c16
---
 trunk/eina/src/include/eina_unicode.h |    2 +-
 trunk/eina/src/lib/eina_unicode.c     |    4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/trunk/eina/src/include/eina_unicode.h b/trunk/eina/src/include/eina_unicode.h
index 1b3ed15..bd4ac1d 100644
--- a/trunk/eina/src/include/eina_unicode.h
+++ b/trunk/eina/src/include/eina_unicode.h
@@ -143,7 +143,7 @@ EAPI Eina_Unicode eina_unicode_utf8_get_next(const char *buf, int *iindex) EINA_
  *
  * @param buf the string
  * @param iindex the index to look at and return by.
- * @return the codepoint found.
+ * @return the codepoint found, 0 if @p buf or @p iindex are NULL
  * @since 1.1.0
  */
 EAPI Eina_Unicode eina_unicode_utf8_get_prev(const char *buf, int *iindex) EINA_ARG_NONNULL(1, 2);
diff --git a/trunk/eina/src/lib/eina_unicode.c b/trunk/eina/src/lib/eina_unicode.c
index 7505906..a1993de 100644
--- a/trunk/eina/src/lib/eina_unicode.c
+++ b/trunk/eina/src/lib/eina_unicode.c
@@ -193,13 +193,15 @@ eina_unicode_escape(const Eina_Unicode *str)
 EAPI Eina_Unicode
 eina_unicode_utf8_get_next(const char *buf, int *iindex)
 {
-   int ind = *iindex;
+   int ind;
    Eina_Unicode r;
    unsigned char d;
 
    EINA_SAFETY_ON_NULL_RETURN_VAL(buf, 0);
    EINA_SAFETY_ON_NULL_RETURN_VAL(iindex, 0);
 
+   ind = *iindex;
+
    /* if this char is the null terminator, exit */
    if ((d = buf[ind++]) == 0) return 0;
 
-- 
1.7.9.5

