From c6483aa2fae07654f8a874a0c479916de33ec592 Mon Sep 17 00:00:00 2001 From: Thiago de Arruda Date: Fri, 23 May 2014 15:49:17 -0300 Subject: API: Bugfix: Fix loop condition in vim_list_runtime_paths --- src/nvim/api/vim.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src') diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index 505844e651..5796d7bc0e 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -94,14 +94,12 @@ StringArray vim_list_runtime_paths(void) rtp++; } - // index - uint32_t i = 0; // Allocate memory for the copies rv.items = xmalloc(sizeof(String) * rv.size); // reset the position rtp = p_rtp; // Start copying - while (*rtp != NUL) { + for (size_t i = 0; i < rv.size && *rtp != NUL; i++) { rv.items[i].data = xmalloc(MAXPATHL); // Copy the path from 'runtimepath' to rv.items[i] int length = copy_option_part(&rtp, @@ -110,7 +108,6 @@ StringArray vim_list_runtime_paths(void) ","); assert(length >= 0); rv.items[i].size = (size_t)length; - i++; } return rv; -- cgit