mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 06:28:35 +00:00
Move concat_strings
from path.c
This commit is contained in:

committed by
Thiago de Arruda

parent
7a4d24d4cc
commit
3f6fe2a888
12
src/path.c
12
src/path.c
@@ -283,18 +283,6 @@ char_u *concat_fnames(char_u *fname1, char_u *fname2, int sep)
|
|||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* 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
|
* Add a path separator to a file name, unless it already ends in a path
|
||||||
* separator.
|
* separator.
|
||||||
|
@@ -534,3 +534,17 @@ int has_non_ascii(char_u *s)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
#endif
|
#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;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -23,4 +23,5 @@ char_u *vim_strbyte(char_u *string, int c);
|
|||||||
char_u *vim_strrchr(char_u *string, int c);
|
char_u *vim_strrchr(char_u *string, int c);
|
||||||
int vim_isspace(int x);
|
int vim_isspace(int x);
|
||||||
void sort_strings(char_u **files, int count);
|
void sort_strings(char_u **files, int count);
|
||||||
|
char_u *concat_str(char_u *str1, char_u *str2);
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user