summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@intel.com>2013-09-25 22:51:03 -0300
committerLucas De Marchi <lucas.demarchi@intel.com>2013-09-25 22:51:03 -0300
commitad76ce025c024ef0909292c791bc6f0836761f54 (patch)
tree29316f088a9eb46bf7a1d6d6920ba4209302c50f
parentf03148f9e327b4542ef426e1db6841cc251e6569 (diff)
Revert "eina: add functions to alloc strings from a printf fmt"
This reverts commit b5fce696c743c50ea0a049c4f879756b5ed231d4 and fixes to NEWS and @since that came later. These functions are pretty trivial and their functionality can be obtained with asprintf() and snprintf. The first is not available only on windows, but there's an implementation for that one on Evil, that should be used instead.
-rw-r--r--ChangeLog1
-rw-r--r--NEWS1
-rw-r--r--src/lib/eina/eina_str.c41
-rw-r--r--src/lib/eina/eina_str.h33
4 files changed, 0 insertions, 76 deletions
diff --git a/ChangeLog b/ChangeLog
index 08204e8c6b..72873d0892 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -14,7 +14,6 @@
142013-09-24 Jorge Zapata 142013-09-24 Jorge Zapata
15 15
16 * Eina: add a substraction in rectangles and more helpers, 16 * Eina: add a substraction in rectangles and more helpers,
17 add functions to alloc strings from a printf format,
18 add double_from/to and helper defines in f16p16. 17 add double_from/to and helper defines in f16p16.
19 18
202013-09-12 Jihoon Kim 192013-09-12 Jihoon Kim
diff --git a/NEWS b/NEWS
index 0dd45afb49..e40c53f056 100644
--- a/NEWS
+++ b/NEWS
@@ -39,7 +39,6 @@ Additions:
39 - Add eina_rectangle_is_valid(), eina_rectangle_max_x(), eina_rectangle_max_y(), eina_rectangle_x_cut(), 39 - Add eina_rectangle_is_valid(), eina_rectangle_max_x(), eina_rectangle_max_y(), eina_rectangle_x_cut(),
40 eina_rectangle_y_cut(), eina_rectangle_width_cut(), eina_rectangle_height_cut(), eina_rectangle_subtract(), 40 eina_rectangle_y_cut(), eina_rectangle_width_cut(), eina_rectangle_height_cut(), eina_rectangle_subtract(),
41 EINA_RECTANGLE_INIT, EINA_RECTANGLE_FORMAT, EINA_RECTANGLE_ARGS. 41 EINA_RECTANGLE_INIT, EINA_RECTANGLE_FORMAT, EINA_RECTANGLE_ARGS.
42 - Add eina_str_vprintf_length(), eina_str_vprintf_dup(), eina_str_printf_dup().
43 - Add eina_f16p16_double_from(), eina_f16p16_double_to(). 42 - Add eina_f16p16_double_from(), eina_f16p16_double_to().
44 * Eet: 43 * Eet:
45 - Add eet_mmap() 44 - Add eet_mmap()
diff --git a/src/lib/eina/eina_str.c b/src/lib/eina/eina_str.c
index 283476b29a..11fef3c7c7 100644
--- a/src/lib/eina/eina_str.c
+++ b/src/lib/eina/eina_str.c
@@ -652,44 +652,3 @@ eina_str_toupper(char **str)
652 for (p = *str; (*p); p++) 652 for (p = *str; (*p); p++)
653 *p = toupper((unsigned char)(*p)); 653 *p = toupper((unsigned char)(*p));
654} 654}
655
656EAPI size_t
657eina_str_vprintf_length(const char *format, va_list args)
658{
659 char c;
660 size_t len;
661
662 len = vsnprintf(&c, 1, format, args) + 1;
663 return len;
664}
665
666EAPI char *
667eina_str_vprintf_dup(const char *format, va_list args)
668{
669 size_t length;
670 char *ret;
671 va_list copy;
672
673 /* be sure to use a copy or the printf implementation will
674 * step into the args
675 */
676 va_copy(copy, args);
677 length = eina_str_vprintf_length(format, copy);
678 va_end(copy);
679
680 ret = calloc(length, sizeof(char));
681 vsprintf(ret, format, args);
682 return ret;
683}
684
685EAPI char *
686eina_str_printf_dup(const char *format, ...)
687{
688 char *ret;
689 va_list args;
690
691 va_start(args, format);
692 ret = eina_str_vprintf_dup(format, args);
693 va_end(args);
694 return ret;
695}
diff --git a/src/lib/eina/eina_str.h b/src/lib/eina/eina_str.h
index 615cc71f38..dae592bac6 100644
--- a/src/lib/eina/eina_str.h
+++ b/src/lib/eina/eina_str.h
@@ -345,39 +345,6 @@ static inline size_t eina_str_join(char *dst, size_t size, char sep, const char
345 345
346static inline size_t eina_strlen_bounded(const char *str, size_t maxlen) EINA_PURE EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1); 346static inline size_t eina_strlen_bounded(const char *str, size_t maxlen) EINA_PURE EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1);
347 347
348/**
349 * @brief Gets the length needed for a string based on a printf format and args
350 *
351 * @param format The printf format
352 * @param args The printf args
353 * @return The length needed for such format and args
354 * @since 1.8
355 */
356EAPI size_t eina_str_vprintf_length(const char *format, va_list args);
357
358/**
359 * @brief Gets a newly allocated string that represents the printf format and args
360 *
361 * @param format The printf format
362 * @param args The printf args
363 * @return A newly allocated string
364 *
365 * @see eina_str_dup_printf
366 * @since 1.8
367 */
368EAPI char * eina_str_vprintf_dup(const char *format, va_list args);
369
370/**
371 * @brief Gets a newly allocated string that represents the printf format and args
372 *
373 * @param format The printf format
374 * @return A newly allocated string
375 *
376 * @see eina_str_dup_vprintf
377 * @since 1.8
378 */
379EAPI char * eina_str_printf_dup(const char *format, ...);
380
381#include "eina_inline_str.x" 348#include "eina_inline_str.x"
382 349
383/** 350/**