summaryrefslogtreecommitdiff
path: root/src/lib/eina/eina_inline_str.x
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2014-09-23 16:15:34 -0400
committerMike Blumenkrantz <zmike@osg.samsung.com>2014-09-23 16:15:34 -0400
commitcbcd9c3718ead0a363fe4688aaba29735fb0e9b9 (patch)
tree93f21acd4cec6505e33d1496be5baa60be8780b2 /src/lib/eina/eina_inline_str.x
parent3dd8fb8a5517fe9061148846c44cd9044c726b39 (diff)
+eina_strdup(), eina_streq()
there are macros/inlines for these in most efl projects I've seen, may as well have them standardized here @feature
Diffstat (limited to 'src/lib/eina/eina_inline_str.x')
-rw-r--r--src/lib/eina/eina_inline_str.x28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/lib/eina/eina_inline_str.x b/src/lib/eina/eina_inline_str.x
index 2daeb8524c..451f35fc11 100644
--- a/src/lib/eina/eina_inline_str.x
+++ b/src/lib/eina/eina_inline_str.x
@@ -70,6 +70,34 @@ eina_str_join(char *dst, size_t size, char sep, const char *a, const char *b)
70} 70}
71 71
72/** 72/**
73 * @brief strdup function which takes @c NULL without crashing
74 * @param str The string to copy
75 * @return the copied string, must be freed
76 * @since 1.12
77 */
78static inline char *
79eina_strdup(const char *str)
80{
81 return str ? strdup(str) : NULL;
82}
83
84/**
85 * @brief streq function which takes @c NULL without crashing
86 * @param a string a
87 * @param b string b
88 * @return true if strings are equal
89 * @since 1.12
90 */
91static inline Eina_Bool
92eina_streq(const char *a, const char *b)
93{
94 if ((!a) && (!b)) return EINA_TRUE;
95 if (!a) return EINA_FALSE;
96 if (!b) return EINA_FALSE;
97 return !strcmp(a, b);
98}
99
100/**
73 * @} 101 * @}
74 */ 102 */
75 103