diff options
author | Felipe Oliveira Carvalho <felipekde@gmail.com> | 2014-05-10 01:09:33 -0300 |
---|---|---|
committer | Felipe Oliveira Carvalho <felipekde@gmail.com> | 2014-05-19 14:50:24 -0300 |
commit | 39a272c4db215c2f6043e8c5de5d2104d8118b4f (patch) | |
tree | 2a395a1cecd1cf5dddf35411efa5db9f65f8f9a4 | |
parent | 27f5f7b1e8ce3a54713bdc0a020b1f327f400f4f (diff) | |
download | rneovim-39a272c4db215c2f6043e8c5de5d2104d8118b4f.tar.gz rneovim-39a272c4db215c2f6043e8c5de5d2104d8118b4f.tar.bz2 rneovim-39a272c4db215c2f6043e8c5de5d2104d8118b4f.zip |
Remove OOM checks: alloc_typebuf()
-rw-r--r-- | src/nvim/ex_docmd.c | 1 | ||||
-rw-r--r-- | src/nvim/getchar.c | 15 | ||||
-rw-r--r-- | src/nvim/getchar.h | 2 |
3 files changed, 6 insertions, 12 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 491f7d671e..a6ef533fbd 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -7380,6 +7380,7 @@ static void ex_normal(exarg_T *eap) * ends with half a command. */ save_typeahead(&tabuf); + // TODO(philix): after save_typeahead() this is always TRUE if (tabuf.typebuf_valid) { /* * Repeat the :normal command for each line in the range. When no diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c index d8e415c845..cc9f65fe29 100644 --- a/src/nvim/getchar.c +++ b/src/nvim/getchar.c @@ -1142,7 +1142,7 @@ static void may_sync_undo(void) /* * Make "typebuf" empty and allocate new buffers. */ -int alloc_typebuf(void) +void alloc_typebuf(void) { typebuf.tb_buf = xmalloc(TYPELEN_INIT); typebuf.tb_noremap = xmalloc(TYPELEN_INIT); @@ -1154,7 +1154,6 @@ int alloc_typebuf(void) typebuf.tb_no_abbr_cnt = 0; if (++typebuf.tb_change_cnt == 0) typebuf.tb_change_cnt = 1; - return OK; } /* @@ -1182,11 +1181,7 @@ int save_typebuf(void) { init_typebuf(); saved_typebuf[curscript] = typebuf; - /* If out of memory: restore typebuf and close file. */ - if (alloc_typebuf() == FAIL) { - closescript(); - return FAIL; - } + alloc_typebuf(); return OK; } @@ -1202,10 +1197,8 @@ static int old_mouse_col; /* mouse_col related to old_char */ void save_typeahead(tasave_T *tp) { tp->save_typebuf = typebuf; - tp->typebuf_valid = (alloc_typebuf() == OK); - if (!tp->typebuf_valid) - typebuf = tp->save_typebuf; - + alloc_typebuf(); + tp->typebuf_valid = TRUE; tp->old_char = old_char; tp->old_mod_mask = old_mod_mask; old_char = -1; diff --git a/src/nvim/getchar.h b/src/nvim/getchar.h index 527573bdab..edb008bd76 100644 --- a/src/nvim/getchar.h +++ b/src/nvim/getchar.h @@ -31,7 +31,7 @@ int typebuf_changed(int tb_change_cnt); int typebuf_typed(void); int typebuf_maplen(void); void del_typebuf(int len, int offset); -int alloc_typebuf(void); +void alloc_typebuf(void); void free_typebuf(void); int save_typebuf(void); void save_typeahead(tasave_T *tp); |