diff options
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | src/lib/eina/eina_str.c | 41 | ||||
-rw-r--r-- | src/lib/eina/eina_str.h | 33 |
4 files changed, 0 insertions, 76 deletions
@@ -14,7 +14,6 @@ | |||
14 | 2013-09-24 Jorge Zapata | 14 | 2013-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 | ||
20 | 2013-09-12 Jihoon Kim | 19 | 2013-09-12 Jihoon Kim |
@@ -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 | |||
656 | EAPI size_t | ||
657 | eina_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 | |||
666 | EAPI char * | ||
667 | eina_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 | |||
685 | EAPI char * | ||
686 | eina_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 | ||
346 | static inline size_t eina_strlen_bounded(const char *str, size_t maxlen) EINA_PURE EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1); | 346 | static 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 | */ | ||
356 | EAPI 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 | */ | ||
368 | EAPI 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 | */ | ||
379 | EAPI 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 | /** |