summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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