aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/change.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/change.c')
-rw-r--r--src/nvim/change.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/nvim/change.c b/src/nvim/change.c
index 5e9edac4f2..ab550259c8 100644
--- a/src/nvim/change.c
+++ b/src/nvim/change.c
@@ -544,7 +544,7 @@ void save_file_ff(buf_T *buf)
// Only use free/alloc when necessary, they take time.
if (buf->b_start_fenc == NULL
- || STRCMP(buf->b_start_fenc, buf->b_p_fenc) != 0) {
+ || strcmp(buf->b_start_fenc, buf->b_p_fenc) != 0) {
xfree(buf->b_start_fenc);
buf->b_start_fenc = xstrdup(buf->b_p_fenc);
}
@@ -582,14 +582,14 @@ bool file_ff_differs(buf_T *buf, bool ignore_empty)
if (buf->b_start_fenc == NULL) {
return *buf->b_p_fenc != NUL;
}
- return STRCMP(buf->b_start_fenc, buf->b_p_fenc) != 0;
+ return strcmp(buf->b_start_fenc, buf->b_p_fenc) != 0;
}
/// Insert string "p" at the cursor position. Stops at a NUL byte.
/// Handles Replace mode and multi-byte characters.
void ins_bytes(char *p)
{
- ins_bytes_len(p, STRLEN(p));
+ ins_bytes_len(p, strlen(p));
}
/// Insert string "p" with length "len" at the cursor position.
@@ -632,7 +632,7 @@ void ins_char_bytes(char *buf, size_t charlen)
size_t col = (size_t)curwin->w_cursor.col;
linenr_T lnum = curwin->w_cursor.lnum;
char *oldp = ml_get(lnum);
- size_t linelen = STRLEN(oldp) + 1; // length of old line including NUL
+ size_t linelen = strlen(oldp) + 1; // length of old line including NUL
// The lengths default to the values for when not replacing.
size_t oldlen = 0; // nr of bytes inserted
@@ -731,7 +731,7 @@ void ins_char_bytes(char *buf, size_t charlen)
/// Caller must have prepared for undo.
void ins_str(char *s)
{
- int newlen = (int)STRLEN(s);
+ int newlen = (int)strlen(s);
linenr_T lnum = curwin->w_cursor.lnum;
if (virtual_active() && curwin->w_cursor.coladd > 0) {
@@ -740,7 +740,7 @@ void ins_str(char *s)
colnr_T col = curwin->w_cursor.col;
char *oldp = ml_get(lnum);
- int oldlen = (int)STRLEN(oldp);
+ int oldlen = (int)strlen(oldp);
char *newp = xmalloc((size_t)oldlen + (size_t)newlen + 1);
if (col > 0) {
@@ -774,7 +774,7 @@ int del_char(bool fixpos)
int del_chars(long count, int fixpos)
{
int bytes = 0;
- char *p = (char *)get_cursor_pos_ptr();
+ char *p = get_cursor_pos_ptr();
for (long i = 0; i < count && *p != NUL; i++) {
int l = utfc_ptr2len(p);
bytes += l;
@@ -798,7 +798,7 @@ int del_bytes(colnr_T count, bool fixpos_arg, bool use_delcombine)
colnr_T col = curwin->w_cursor.col;
bool fixpos = fixpos_arg;
char *oldp = ml_get(lnum);
- colnr_T oldlen = (colnr_T)STRLEN(oldp);
+ colnr_T oldlen = (colnr_T)strlen(oldp);
// Can't do anything when the cursor is on the NUL after the line.
if (col >= oldlen) {
@@ -962,7 +962,7 @@ int copy_indent(int size, char *src)
if (p == NULL) {
// Allocate memory for the result: the copied indent, new indent
// and the rest of the line.
- line_len = (int)STRLEN(get_cursor_line_ptr()) + 1;
+ line_len = (int)strlen(get_cursor_line_ptr()) + 1;
assert(ind_len + line_len >= 0);
size_t line_size;
STRICT_ADD(ind_len, line_len, &line_size, size_t);
@@ -1036,7 +1036,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
colnr_T mincol = curwin->w_cursor.col + 1;
// make a copy of the current line so we can mess with it
- char *saved_line = (char *)vim_strsave((char_u *)get_cursor_line_ptr());
+ char *saved_line = xstrdup(get_cursor_line_ptr());
if (State & VREPLACE_FLAG) {
// With MODE_VREPLACE we make a copy of the next line, which we will be
@@ -1072,7 +1072,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
p = skipwhite(p_extra);
first_char = (unsigned char)(*p);
}
- extra_len = (int)STRLEN(p_extra);
+ extra_len = (int)strlen(p_extra);
saved_char = *p_extra;
*p_extra = NUL;
}
@@ -1155,7 +1155,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
}
} else { // Not a comment line
// Find last non-blank in line
- p = ptr + STRLEN(ptr) - 1;
+ p = ptr + strlen(ptr) - 1;
while (p > ptr && ascii_iswhite(*p)) {
p--;
}
@@ -1205,7 +1205,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
while ((ptr[0] == '#' || was_backslashed)
&& curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count) {
- if (*ptr && ptr[STRLEN(ptr) - 1] == '\\') {
+ if (*ptr && ptr[strlen(ptr) - 1] == '\\') {
was_backslashed = true;
} else {
was_backslashed = false;
@@ -1331,7 +1331,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
if (lead_len > 0) {
if (current_flag == COM_START) {
lead_repl = (char *)lead_middle;
- lead_repl_len = (int)STRLEN(lead_middle);
+ lead_repl_len = (int)strlen(lead_middle);
}
// If we have hit RETURN immediately after the start
@@ -1641,7 +1641,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
if (flags & OPENLINE_COM_LIST && second_line_indent > 0) {
int i;
int padding = second_line_indent
- - (newindent + (int)STRLEN(leader));
+ - (newindent + (int)strlen(leader));
// Here whitespace is inserted after the comment char.
// Below, set_indent(newindent, SIN_INSERT) will insert the
@@ -1755,7 +1755,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
}
ml_replace(curwin->w_cursor.lnum, saved_line, false);
- int new_len = (int)STRLEN(saved_line);
+ int new_len = (int)strlen(saved_line);
// TODO(vigoux): maybe there is issues there with expandtabs ?
int cols_spliced = 0;
@@ -1795,7 +1795,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
if (did_append) {
changed_lines(curwin->w_cursor.lnum, 0, curwin->w_cursor.lnum, 1L, true);
// bail out and just get the final length of the line we just manipulated
- bcount_t extra = (bcount_t)STRLEN(ml_get(curwin->w_cursor.lnum));
+ bcount_t extra = (bcount_t)strlen(ml_get(curwin->w_cursor.lnum));
extmark_splice(curbuf, (int)curwin->w_cursor.lnum - 1, 0,
0, 0, 0, 1, 0, 1 + extra, kExtmarkUndo);
}
@@ -2084,7 +2084,7 @@ int get_last_leader_offset(char *line, char **flags)
char part_buf[COM_MAX_LEN]; // buffer for one option part
// Repeat to match several nested comment strings.
- int i = (int)STRLEN(line);
+ int i = (int)strlen(line);
while (--i >= lower_check_bound) {
// scan through the 'comments' option for a match
int found_one = false;
@@ -2171,7 +2171,7 @@ int get_last_leader_offset(char *line, char **flags)
while (ascii_iswhite(*com_leader)) {
com_leader++;
}
- len1 = (int)STRLEN(com_leader);
+ len1 = (int)strlen(com_leader);
for (list = curbuf->b_p_com; *list;) {
char *flags_save = list;
@@ -2185,7 +2185,7 @@ int get_last_leader_offset(char *line, char **flags)
while (ascii_iswhite(*string)) {
string++;
}
- len2 = (int)STRLEN(string);
+ len2 = (int)strlen(string);
if (len2 == 0) {
continue;
}