aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Oliveira Carvalho <felipekde@gmail.com>2014-05-10 00:33:20 -0300
committerFelipe Oliveira Carvalho <felipekde@gmail.com>2014-05-19 14:50:23 -0300
commite5e3cbf320659f56ad48ded5077a4a91ad23a6cc (patch)
tree7153eee29e4121f849646336384964f9bda3427c
parent21784aeb005e78f04f4c1d398bc486be0a65248e (diff)
downloadrneovim-e5e3cbf320659f56ad48ded5077a4a91ad23a6cc.tar.gz
rneovim-e5e3cbf320659f56ad48ded5077a4a91ad23a6cc.tar.bz2
rneovim-e5e3cbf320659f56ad48ded5077a4a91ad23a6cc.zip
Remove OOM checks: reverse_text()
-rw-r--r--src/nvim/popupmnu.c43
-rw-r--r--src/nvim/search.c14
2 files changed, 25 insertions, 32 deletions
diff --git a/src/nvim/popupmnu.c b/src/nvim/popupmnu.c
index 7408ce292b..4c31e9e0ae 100644
--- a/src/nvim/popupmnu.c
+++ b/src/nvim/popupmnu.c
@@ -345,32 +345,27 @@ void pum_redraw(void)
*p = saved;
if (curwin->w_p_rl) {
- char_u *rt = reverse_text(st);
-
- if (rt != NULL) {
- char_u *rt_start = rt;
- int size;
-
- size = vim_strsize(rt);
-
- if (size > pum_width) {
- do {
- size -= has_mbyte ? (*mb_ptr2cells)(rt) : 1;
- mb_ptr_adv(rt);
- } while (size > pum_width);
-
- if (size < pum_width) {
- // Most left character requires 2-cells but only 1 cell
- // is available on screen. Put a '<' on the left of the
- // pum item
- *(--rt) = '<';
- size++;
- }
+ char_u *rt = reverse_text(st);
+ char_u *rt_start = rt;
+ int size = vim_strsize(rt);
+
+ if (size > pum_width) {
+ do {
+ size -= has_mbyte ? (*mb_ptr2cells)(rt) : 1;
+ mb_ptr_adv(rt);
+ } while (size > pum_width);
+
+ if (size < pum_width) {
+ // Most left character requires 2-cells but only 1 cell
+ // is available on screen. Put a '<' on the left of the
+ // pum item
+ *(--rt) = '<';
+ size++;
}
- screen_puts_len(rt, (int)STRLEN(rt), row, col - size + 1,
- attr);
- free(rt_start);
}
+ screen_puts_len(rt, (int)STRLEN(rt), row, col - size + 1,
+ attr);
+ free(rt_start);
free(st);
col -= width;
diff --git a/src/nvim/search.c b/src/nvim/search.c
index 48616105db..9d37aa3339 100644
--- a/src/nvim/search.c
+++ b/src/nvim/search.c
@@ -230,7 +230,9 @@ char_u *get_search_pat(void)
/*
* Reverse text into allocated memory.
- * Returns the allocated string, NULL when out of memory.
+ * Returns the allocated string.
+ *
+ * TODO(philix): move reverse_text() to strings.c
*/
char_u *reverse_text(char_u *s)
{
@@ -1080,13 +1082,9 @@ proftime_T *tm; /* timeout limit or NULL */
* it would be blanked out again very soon. Show it on the
* left, but do reverse the text. */
if (curwin->w_p_rl && *curwin->w_p_rlc == 's') {
- char_u *r;
-
- r = reverse_text(trunc != NULL ? trunc : msgbuf);
- if (r != NULL) {
- free(trunc);
- trunc = r;
- }
+ char_u *r = reverse_text(trunc != NULL ? trunc : msgbuf);
+ free(trunc);
+ trunc = r;
}
if (trunc != NULL) {
msg_outtrans(trunc);