aboutsummaryrefslogtreecommitdiff
path: root/src/os_unix.c
diff options
context:
space:
mode:
authorThiago de Arruda <tpadilha84@gmail.com>2014-03-29 12:41:18 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2014-03-31 08:07:46 -0300
commit8a61c27b1e301bb342758434f23bd7828790dcdf (patch)
treee1749fdfee920419eb3da1d6a4f60ec32aec5ef5 /src/os_unix.c
parent2d28251a6e2850998f475c76a886121554c9b7e9 (diff)
downloadrneovim-8a61c27b1e301bb342758434f23bd7828790dcdf.tar.gz
rneovim-8a61c27b1e301bb342758434f23bd7828790dcdf.tar.bz2
rneovim-8a61c27b1e301bb342758434f23bd7828790dcdf.zip
Extract `shell_count_argc` from `mch_call_shell`
Diffstat (limited to 'src/os_unix.c')
-rw-r--r--src/os_unix.c21
1 files changed, 1 insertions, 20 deletions
diff --git a/src/os_unix.c b/src/os_unix.c
index 7324f1318b..7a3124130f 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -1723,26 +1723,7 @@ int options; /* SHELL_*, see vim.h */
// Count the number of arguments for the shell
p = newcmd;
- argc = 0;
- while (true) {
- ++argc;
- shell_skip_word(&p);
- if (*p == NUL)
- break;
- // Move to the next word
- p = skipwhite(p);
- }
-
- // Account for multiple args in p_shcf('shellcmdflag' option)
- p = p_shcf;
- while (true) {
- // Same as above, but doesn't need to take quotes into consideration
- p = skiptowhite(p);
- if (*p == NUL)
- break;
- ++argc;
- p = skipwhite(p);
- }
+ argc = shell_count_argc(&p);
// Allocate argv memory
argv = (char **)alloc((unsigned)((argc + 4) * sizeof(char *)));