aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/strings.c
diff options
context:
space:
mode:
authorDundar Göc <gocdundar@gmail.com>2022-08-26 23:11:25 +0200
committerdundargoc <gocdundar@gmail.com>2022-11-26 15:52:21 +0100
commitbd22585061b66d7f71d4832b4a81e950b3c9d19d (patch)
tree8c677ace61ab212cef87bc5abbd83c56e50f800d /src/nvim/strings.c
parent29b80f6f2e9391b5d78390f65d09f00f73829310 (diff)
downloadrneovim-bd22585061b66d7f71d4832b4a81e950b3c9d19d.tar.gz
rneovim-bd22585061b66d7f71d4832b4a81e950b3c9d19d.tar.bz2
rneovim-bd22585061b66d7f71d4832b4a81e950b3c9d19d.zip
refactor: replace char_u with char
Work on https://github.com/neovim/neovim/issues/459
Diffstat (limited to 'src/nvim/strings.c')
-rw-r--r--src/nvim/strings.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/nvim/strings.c b/src/nvim/strings.c
index 7fdcaaa355..cfe821715c 100644
--- a/src/nvim/strings.c
+++ b/src/nvim/strings.c
@@ -137,15 +137,16 @@ char *vim_strnsave_unquoted(const char *const string, const size_t length)
return ret;
}
-// Escape "string" for use as a shell argument with system().
-// This uses single quotes, except when we know we need to use double quotes
-// (MS-Windows without 'shellslash' set).
-// Escape a newline, depending on the 'shell' option.
-// When "do_special" is true also replace "!", "%", "#" and things starting
-// with "<" like "<cfile>".
-// When "do_newline" is false do not escape newline unless it is csh shell.
-// Returns the result in allocated memory.
-char_u *vim_strsave_shellescape(const char_u *string, bool do_special, bool do_newline)
+/// Escape "string" for use as a shell argument with system().
+/// This uses single quotes, except when we know we need to use double quotes
+/// (MS-Windows without 'shellslash' set).
+/// Escape a newline, depending on the 'shell' option.
+/// When "do_special" is true also replace "!", "%", "#" and things starting
+/// with "<" like "<cfile>".
+/// When "do_newline" is false do not escape newline unless it is csh shell.
+///
+/// @return the result in allocated memory.
+char *vim_strsave_shellescape(const char *string, bool do_special, bool do_newline)
FUNC_ATTR_NONNULL_RET FUNC_ATTR_MALLOC FUNC_ATTR_NONNULL_ALL
{
char *d;
@@ -165,8 +166,8 @@ char_u *vim_strsave_shellescape(const char_u *string, bool do_special, bool do_n
fish_like = fish_like_shell();
// First count the number of extra bytes required.
- size_t length = STRLEN(string) + 3; // two quotes and a trailing NUL
- for (const char_u *p = string; *p != NUL; MB_PTR_ADV(p)) {
+ size_t length = strlen(string) + 3; // two quotes and a trailing NUL
+ for (const char_u *p = (char_u *)string; *p != NUL; MB_PTR_ADV(p)) {
#ifdef MSWIN
if (!p_ssl) {
if (*p == '"') {
@@ -258,7 +259,7 @@ char_u *vim_strsave_shellescape(const char_u *string, bool do_special, bool do_n
*d++ = '\'';
*d = NUL;
- return escaped_string;
+ return (char *)escaped_string;
}
// Like vim_strsave(), but make all characters uppercase.
@@ -338,12 +339,12 @@ char *strcase_save(const char *const orig, bool upper)
}
// delete spaces at the end of a string
-void del_trailing_spaces(char_u *ptr)
+void del_trailing_spaces(char *ptr)
FUNC_ATTR_NONNULL_ALL
{
- char_u *q;
+ char *q;
- q = ptr + STRLEN(ptr);
+ q = ptr + strlen(ptr);
while (--q > ptr && ascii_iswhite(q[0]) && q[-1] != '\\' && q[-1] != Ctrl_V) {
*q = NUL;
}