aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.de.marchi@gmail.com>2013-09-24 11:39:27 -0300
committerLucas De Marchi <lucas.de.marchi@gmail.com>2013-09-24 12:14:34 -0300
commitff57a673fec292007a353b5330b6eac2327c55ce (patch)
tree500774e634d420d554a60f5107bc377806885812
parenteo: rename _Eo_Internal -> _Eo_Object (diff)
downloadefl-ff57a673fec292007a353b5330b6eac2327c55ce.tar.gz
eina: fix length calc when 0
-rw-r--r--src/lib/eina/eina_str.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/eina/eina_str.c b/src/lib/eina/eina_str.c
index 283476b29a..9d67029378 100644
--- a/src/lib/eina/eina_str.c
+++ b/src/lib/eina/eina_str.c
@@ -656,11 +656,11 @@ eina_str_toupper(char **str)
EAPI size_t
eina_str_vprintf_length(const char *format, va_list args)
{
- char c;
- size_t len;
+ ssize_t len = vsnprintf(NULL, 0, format, args);
+ if (len < 0)
+ return 0;
- len = vsnprintf(&c, 1, format, args) + 1;
- return len;
+ return len;
}
EAPI char *