diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2021-08-10 23:22:25 +0200 |
---|---|---|
committer | Björn Linse <bjorn.linse@gmail.com> | 2021-08-10 23:22:25 +0200 |
commit | 8bf318dcde0f4508dfbcc7e5f3f537098f38933f (patch) | |
tree | f5699d5a82540f84413122782a102a567914b7e7 /src | |
parent | ac56a27a108012b80f5ed61be7370f10bbeb9d41 (diff) | |
download | rneovim-8bf318dcde0f4508dfbcc7e5f3f537098f38933f.tar.gz rneovim-8bf318dcde0f4508dfbcc7e5f3f537098f38933f.tar.bz2 rneovim-8bf318dcde0f4508dfbcc7e5f3f537098f38933f.zip |
refactor(plines): what is basic compiler optimizations?
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/charset.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/nvim/charset.c b/src/nvim/charset.c index eeeea3f8f6..72d101108a 100644 --- a/src/nvim/charset.c +++ b/src/nvim/charset.c @@ -735,23 +735,20 @@ int vim_strnsize(char_u *s, int len) /// Return the number of characters 'c' will take on the screen, taking /// into account the size of a tab. -/// Use a define to make it fast, this is used very often!!! /// Also see getvcol() below. /// /// @param p /// @param col /// /// @return Number of characters. -#define RET_WIN_BUF_CHARTABSIZE(wp, buf, p, col) \ - if (*(p) == TAB && (!(wp)->w_p_list || wp->w_p_lcs_chars.tab1)) { \ - return tabstop_padding(col, (buf)->b_p_ts, (buf)->b_p_vts_array); \ - } else { \ - return ptr2cells(p); \ - } - int win_chartabsize(win_T *wp, char_u *p, colnr_T col) { - RET_WIN_BUF_CHARTABSIZE(wp, wp->w_buffer, p, col) + buf_T *buf = wp->w_buffer; + if (*p == TAB && (!wp->w_p_list || wp->w_p_lcs_chars.tab1)) { + return tabstop_padding(col, buf->b_p_ts, buf->b_p_vts_array); + } else { + return ptr2cells(p); + } } /// Return the number of characters the string 's' will take on the screen, @@ -944,7 +941,7 @@ int lbr_chartabsize(char_u *line, unsigned char *s, colnr_T col) if (curwin->w_p_wrap) { return win_nolbr_chartabsize(curwin, s, col, NULL); } - RET_WIN_BUF_CHARTABSIZE(curwin, curbuf, s, col) + return win_chartabsize(curwin, s, col); } return win_lbr_chartabsize(curwin, line == NULL ? s: line, s, col, NULL); } @@ -994,7 +991,7 @@ int win_lbr_chartabsize(win_T *wp, char_u *line, char_u *s, colnr_T col, int *he if (wp->w_p_wrap) { return win_nolbr_chartabsize(wp, s, col, headp); } - RET_WIN_BUF_CHARTABSIZE(wp, wp->w_buffer, s, col) + return win_chartabsize(wp, s, col); } // First get normal size, without 'linebreak' |