aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/elementary/src/lib/elm_util.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--libraries/elementary/src/lib/elm_util.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/libraries/elementary/src/lib/elm_util.c b/libraries/elementary/src/lib/elm_util.c
new file mode 100644
index 0000000..935acd3
--- /dev/null
+++ b/libraries/elementary/src/lib/elm_util.c
@@ -0,0 +1,46 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4#include <Elementary.h>
5#include "elm_priv.h"
6
7char *
8_str_ncpy(char *dest, const char *src, size_t count)
9{
10 if ((!dest) || (!src)) return NULL;
11 return strncpy(dest, src, count);
12}
13
14char *
15_str_append(char *str, const char *txt, int *len, int *alloc)
16{
17 int txt_len = strlen(txt);
18
19 if (txt_len <= 0) return str;
20 if ((*len + txt_len) >= *alloc)
21 {
22 char *str2;
23 int alloc2;
24
25 alloc2 = *alloc + txt_len + 128;
26 str2 = realloc(str, alloc2);
27 if (!str2) return str;
28 *alloc = alloc2;
29 str = str2;
30 }
31 strcpy(str + *len, txt);
32 *len += txt_len;
33 return str;
34}
35
36char *
37_elm_util_mkup_to_text(const char *mkup)
38{
39 return evas_textblock_text_markup_to_utf8(NULL, mkup);
40}
41
42char *
43_elm_util_text_to_mkup(const char *text)
44{
45 return evas_textblock_text_utf8_to_markup(NULL, text);
46}