jaehwan pushed a commit to branch master. http://git.enlightenment.org/tools/eflete.git/commit/?id=aee2f39e4493721a9e2eff59012c021a26158c72
commit aee2f39e4493721a9e2eff59012c021a26158c72 Author: Jaehwan Kim <[email protected]> Date: Thu Dec 8 17:44:18 2016 +0900 string: allocate the string memory dynamically. --- src/bin/common/string_common.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/bin/common/string_common.c b/src/bin/common/string_common.c index a11e825..712a0c9 100644 --- a/src/bin/common/string_common.c +++ b/src/bin/common/string_common.c @@ -102,8 +102,11 @@ char * string_backslash_insert(const char *str, char src) { assert(str != NULL); - char dst[256]; + char *dst; int i = 0; + int count = 1; + + dst = mem_malloc((strlen(str) + count) * sizeof(char)); while (*str != '\0') { @@ -111,6 +114,8 @@ string_backslash_insert(const char *str, char src) dst[i] = *str; else { + count++; + dst = mem_malloc((strlen(str) + count) * sizeof(char)); dst[i++] = '\\'; dst[i] = src; } @@ -119,7 +124,7 @@ string_backslash_insert(const char *str, char src) } dst[i] = '\0'; - return strdup(dst); + return dst; } /** --
