aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Schmidt <john.schmidt.h@gmail.com>2014-04-28 22:32:26 +0200
committerThiago de Arruda <tpadilha84@gmail.com>2014-05-02 15:36:13 -0300
commit3f6fe2a88889a1b1d6731dcdadcc20598626a9d7 (patch)
treeb5da9ffde2823887cda39088897bec6aa7f65c8e
parent7a4d24d4cc29ecd172b2848d97b0afca25c34973 (diff)
downloadrneovim-3f6fe2a88889a1b1d6731dcdadcc20598626a9d7.tar.gz
rneovim-3f6fe2a88889a1b1d6731dcdadcc20598626a9d7.tar.bz2
rneovim-3f6fe2a88889a1b1d6731dcdadcc20598626a9d7.zip
Move `concat_strings` from path.c
-rw-r--r--src/path.c12
-rw-r--r--src/strings.c14
-rw-r--r--src/strings.h1
3 files changed, 15 insertions, 12 deletions
diff --git a/src/path.c b/src/path.c
index 6e736f1daa..b4d5687e5c 100644
--- a/src/path.c
+++ b/src/path.c
@@ -284,18 +284,6 @@ char_u *concat_fnames(char_u *fname1, char_u *fname2, int sep)
}
/*
- * Concatenate two strings and return the result in allocated memory.
- */
-char_u *concat_str(char_u *str1, char_u *str2)
-{
- size_t l = STRLEN(str1);
- char_u *dest = xmalloc(l + STRLEN(str2) + 1);
- STRCPY(dest, str1);
- STRCPY(dest + l, str2);
- return dest;
-}
-
-/*
* Add a path separator to a file name, unless it already ends in a path
* separator.
*/
diff --git a/src/strings.c b/src/strings.c
index f9c4e2f1db..87d5cc37c5 100644
--- a/src/strings.c
+++ b/src/strings.c
@@ -534,3 +534,17 @@ int has_non_ascii(char_u *s)
return FALSE;
}
#endif
+
+/*
+ * Concatenate two strings and return the result in allocated memory.
+ * Returns NULL when out of memory.
+ */
+char_u *concat_str(char_u *str1, char_u *str2)
+{
+ size_t l = STRLEN(str1);
+ char_u *dest = xmalloc(l + STRLEN(str2) + 1);
+ STRCPY(dest, str1);
+ STRCPY(dest + l, str2);
+ return dest;
+}
+
diff --git a/src/strings.h b/src/strings.h
index bd34d870ea..2a4fd19fb9 100644
--- a/src/strings.h
+++ b/src/strings.h
@@ -23,4 +23,5 @@ char_u *vim_strbyte(char_u *string, int c);
char_u *vim_strrchr(char_u *string, int c);
int vim_isspace(int x);
void sort_strings(char_u **files, int count);
+char_u *concat_str(char_u *str1, char_u *str2);
#endif