refactor: eliminate misc2.c

move `call_shell` to misc1.c
Move some fns to state.c
Move some fns to option.c
Move some fns to memline.c
Move `vim_chdir*` fns to file_search.c
Move some fns to new module, bytes.c
Move some fns to fileio.c
This commit is contained in:
Justin M. Keyes
2016-09-11 04:01:41 +02:00
parent 7eb4d2f79d
commit df072c3b2b
72 changed files with 489 additions and 609 deletions

View File

@@ -31,7 +31,6 @@
#include "nvim/memline.h"
#include "nvim/memory.h"
#include "nvim/message.h"
#include "nvim/misc2.h"
#include "nvim/garray.h"
#include "nvim/move.h"
#include "nvim/mouse.h"
@@ -41,6 +40,7 @@
#include "nvim/regexp.h"
#include "nvim/screen.h"
#include "nvim/search.h"
#include "nvim/state.h"
#include "nvim/strings.h"
#include "nvim/tag.h"
#include "nvim/ui.h"
@@ -1745,18 +1745,6 @@ int gchar_pos(pos_T *pos)
return (int)*ptr;
}
/*
* Skip to next part of an option argument: Skip space and comma.
*/
char_u *skip_to_option_part(char_u *p)
{
if (*p == ',')
++p;
while (*p == ' ')
++p;
return p;
}
/*
* Call this function when something in the current buffer is changed.
*
@@ -2691,6 +2679,42 @@ void fast_breakcheck(void)
}
}
// Call shell. Calls os_call_shell, with 'shellxquote' added.
int call_shell(char_u *cmd, ShellOpts opts, char_u *extra_shell_arg)
{
int retval;
proftime_T wait_time;
if (p_verbose > 3) {
verbose_enter();
smsg(_("Calling shell to execute: \"%s\""),
cmd == NULL ? p_sh : cmd);
ui_putc('\n');
verbose_leave();
}
if (do_profiling == PROF_YES) {
prof_child_enter(&wait_time);
}
if (*p_sh == NUL) {
EMSG(_(e_shellempty));
retval = -1;
} else {
// The external command may update a tags file, clear cached tags.
tag_freematch();
retval = os_call_shell(cmd, opts, extra_shell_arg);
}
set_vim_var_nr(VV_SHELL_ERROR, (varnumber_T)retval);
if (do_profiling == PROF_YES) {
prof_child_exit(&wait_time);
}
return retval;
}
/// Get the stdout of an external command.
/// If "ret_len" is NULL replace NUL characters with NL. When "ret_len" is not
/// NULL store the length there.