summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2014-09-23 15:51:51 -0400
committerMike Blumenkrantz <zmike@osg.samsung.com>2014-09-23 15:56:46 -0400
commit3dd8fb8a5517fe9061148846c44cd9044c726b39 (patch)
treea912ce611f5271dead50b586b7885b59368e064d
parent5375e154fef210e0531ab94809183bb02dabe0d5 (diff)
move eina_value_util_time_string_new() to not inline
uses strptime which will cause warnings for people who don't do includes correctly
-rw-r--r--src/lib/eina/eina_inline_value_util.x24
-rw-r--r--src/lib/eina/eina_value_util.c15
-rw-r--r--src/lib/eina/eina_value_util.h8
3 files changed, 23 insertions, 24 deletions
diff --git a/src/lib/eina/eina_inline_value_util.x b/src/lib/eina/eina_inline_value_util.x
index e7534e7f8f..2cb96e4dc0 100644
--- a/src/lib/eina/eina_inline_value_util.x
+++ b/src/lib/eina/eina_inline_value_util.x
@@ -20,10 +20,6 @@
20#ifndef EINA_INLINE_VALUE_UTIL_X_ 20#ifndef EINA_INLINE_VALUE_UTIL_X_
21#define EINA_INLINE_VALUE_UTIL_X_ 21#define EINA_INLINE_VALUE_UTIL_X_
22 22
23#ifdef HAVE_CONFIG_H
24# include "config.h"
25#endif
26
27#include <inttypes.h> 23#include <inttypes.h>
28#include <math.h> 24#include <math.h>
29#include <time.h> 25#include <time.h>
@@ -164,26 +160,6 @@ eina_value_util_time_new(time_t t)
164 160
165/** 161/**
166 * @brief Create a new #Eina_Value containing the passed parameter 162 * @brief Create a new #Eina_Value containing the passed parameter
167 * @param timestr The value to use
168 * @return The #Eina_Value
169 * @since 1.12
170 */
171static inline Eina_Value *
172eina_value_util_time_string_new(const char *timestr)
173{
174 Eina_Value *v;
175 struct tm tm;
176 time_t t;
177
178 if (!strptime(timestr, "%Y%m%dT%H:%M:%S", &tm)) return NULL;
179 t = mktime(&tm);
180 v = eina_value_new(EINA_VALUE_TYPE_TIMESTAMP);
181 if (v) eina_value_set(v, t);
182 return v;
183}
184
185/**
186 * @brief Create a new #Eina_Value containing the passed parameter
187 * @param val The value to use 163 * @param val The value to use
188 * @return The #Eina_Value 164 * @return The #Eina_Value
189 * @since 1.12 165 * @since 1.12
diff --git a/src/lib/eina/eina_value_util.c b/src/lib/eina/eina_value_util.c
index 261eba2dc2..4bfd9774e1 100644
--- a/src/lib/eina/eina_value_util.c
+++ b/src/lib/eina/eina_value_util.c
@@ -23,6 +23,7 @@
23#include "eina_safety_checks.h" 23#include "eina_safety_checks.h"
24#include "eina_value.h" 24#include "eina_value.h"
25#include "eina_stringshare.h" 25#include "eina_stringshare.h"
26#include <time.h>
26 27
27 28
28typedef struct _Eina_Value_Util_Struct_Desc 29typedef struct _Eina_Value_Util_Struct_Desc
@@ -78,3 +79,17 @@ eina_value_util_struct_desc_new(void)
78 st_desc->base.ops = &operations; 79 st_desc->base.ops = &operations;
79 return (Eina_Value_Struct_Desc*)st_desc; 80 return (Eina_Value_Struct_Desc*)st_desc;
80} 81}
82
83EAPI Eina_Value *
84eina_value_util_time_string_new(const char *timestr)
85{
86 Eina_Value *v;
87 struct tm tm;
88 time_t t;
89
90 if (!strptime(timestr, "%Y%m%dT%H:%M:%S", &tm)) return NULL;
91 t = mktime(&tm);
92 v = eina_value_new(EINA_VALUE_TYPE_TIMESTAMP);
93 if (v) eina_value_set(v, t);
94 return v;
95}
diff --git a/src/lib/eina/eina_value_util.h b/src/lib/eina/eina_value_util.h
index b4022a5a03..8bc8330a0e 100644
--- a/src/lib/eina/eina_value_util.h
+++ b/src/lib/eina/eina_value_util.h
@@ -35,6 +35,14 @@
35 */ 35 */
36EAPI Eina_Value_Struct_Desc *eina_value_util_struct_desc_new(void); 36EAPI Eina_Value_Struct_Desc *eina_value_util_struct_desc_new(void);
37 37
38/**
39 * @brief Create a new #Eina_Value containing the passed parameter
40 * @param timestr The value to use
41 * @return The #Eina_Value
42 * @since 1.12
43 */
44EAPI Eina_Value *eina_value_util_time_string_new(const char *timestr);
45
38#include "eina_inline_value_util.x" 46#include "eina_inline_value_util.x"
39 47
40/** 48/**