diff options
author | Thiago de Arruda <tpadilha84@gmail.com> | 2014-04-18 12:05:04 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-04-18 16:12:00 -0300 |
commit | 7fb36ebb1dbfdcb33c8061a2e7916c4bd7c800e5 (patch) | |
tree | 34265338cf599daaad00d55a1e9d622414a1b6d2 | |
parent | 246d92edb57bc758b1d13f4ae98e7ea534429902 (diff) | |
download | rneovim-7fb36ebb1dbfdcb33c8061a2e7916c4bd7c800e5.tar.gz rneovim-7fb36ebb1dbfdcb33c8061a2e7916c4bd7c800e5.tar.bz2 rneovim-7fb36ebb1dbfdcb33c8061a2e7916c4bd7c800e5.zip |
Remove unnecessary cleanup label from `job_start`
The argument vector is now freed in the `close_cb` function in job.c
-rw-r--r-- | src/eval.c | 17 | ||||
-rw-r--r-- | src/os/job.c | 2 |
2 files changed, 5 insertions, 14 deletions
diff --git a/src/eval.c b/src/eval.c index 8cd9f30f0a..f4ec36fd2e 100644 --- a/src/eval.c +++ b/src/eval.c @@ -63,7 +63,6 @@ #include "window.h" #include "os/os.h" #include "os/job.h" -#include "os/shell.h" #include "os/rstream.h" #include "os/rstream_defs.h" @@ -11023,7 +11022,7 @@ static void f_job_start(typval_T *argvars, typval_T *rettv) rettv->vval.v_number = 0; if (check_restricted() || check_secure()) { - goto cleanup; + return; } if (argvars[0].v_type != VAR_STRING @@ -11032,7 +11031,7 @@ static void f_job_start(typval_T *argvars, typval_T *rettv) && argvars[2].v_type != VAR_UNKNOWN)) { // Wrong argument types EMSG(_(e_invarg)); - goto cleanup; + return; } argsl = 0; @@ -11043,7 +11042,7 @@ static void f_job_start(typval_T *argvars, typval_T *rettv) for (arg = args->lv_first; arg != NULL; arg = arg->li_next) { if (arg->li_tv.v_type != VAR_STRING) { EMSG(_(e_invarg)); - goto cleanup; + return; } } } @@ -11051,7 +11050,7 @@ static void f_job_start(typval_T *argvars, typval_T *rettv) if (!os_can_exe(get_tv_string(&argvars[1]))) { // String is not executable EMSG2(e_jobexe, get_tv_string(&argvars[1])); - goto cleanup; + return; } // Allocate extra memory for the argument vector and the NULL pointer @@ -11085,14 +11084,6 @@ static void f_job_start(typval_T *argvars, typval_T *rettv) EMSG(_(e_jobexe)); } } - -cleanup: - if (rettv->vval.v_number > 0) { - // Success - return; - } - // Cleanup argv memory in case the `job_start` call failed - shell_free_argv(argv); } // "jobstop()" function diff --git a/src/os/job.c b/src/os/job.c index bb3887d5bd..443fe50a41 100644 --- a/src/os/job.c +++ b/src/os/job.c @@ -248,7 +248,6 @@ void job_exit_event(Event event) job->exit_cb(job, job->data); // Free the job resources - shell_free_argv(job->proc_opts.args); free_job(job); // Stop polling job status if this was the last @@ -356,6 +355,7 @@ static void close_cb(uv_handle_t *handle) rstream_free(job->out); rstream_free(job->err); wstream_free(job->in); + shell_free_argv(job->proc_opts.args); free(job->data); free(job); } |