From: Michael D. Lowis Date: Tue, 20 Mar 2018 02:21:27 +0000 (-0400) Subject: removed function pointer from job starting routine X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=b768226729862a87b334bfa652ff52d24c3859c3;p=projs%2Ftide.git removed function pointer from job starting routine --- diff --git a/inc/edit.h b/inc/edit.h index 6cb1485..f3f47e7 100644 --- a/inc/edit.h +++ b/inc/edit.h @@ -227,7 +227,7 @@ Rune view_getrune(View* view); /* Command Executions *****************************************************************************/ bool exec_reap(void); -void exec_job(char** cmd, char* data, size_t ndata, View* dest, void (*donefn)(int)); +void exec_job(char** cmd, char* data, size_t ndata, View* dest); int exec_cmd(char** cmd, char* text, char** out, char** err); int exec_spawn(char** cmd, int* in, int* out); diff --git a/lib/exec.c b/lib/exec.c index b3e650a..6072dd8 100644 --- a/lib/exec.c +++ b/lib/exec.c @@ -35,7 +35,6 @@ struct Job { Rcvr err_rcvr; /* reciever for the error output of the job */ Rcvr out_rcvr; /* receiver for the normal output of the job */ View* dest; /* destination view where output will be placed */ - void (*donefn)(int); /* function called with return status of the job */ }; static Job* JobList = NULL; @@ -57,7 +56,6 @@ bool exec_reap(void) { rcvr_finish(&(job->out_rcvr)); rcvr_finish(&(job->err_rcvr)); waitpid(job->proc.pid, &status, WNOHANG); - if (job->donefn) job->donefn(status); job = job_finish(job); } else { job = job->next; @@ -68,7 +66,7 @@ bool exec_reap(void) { return (JobList != NULL); } -void exec_job(char** cmd, char* data, size_t ndata, View* dest, void (*donefn)(int)) { +void exec_job(char** cmd, char* data, size_t ndata, View* dest) { Job* job = calloc(1, sizeof(Job)); job->proc.pid = execute(cmd, &(job->proc)); if (job->proc.pid < 0) { @@ -83,7 +81,6 @@ void exec_job(char** cmd, char* data, size_t ndata, View* dest, void (*donefn)(i job->nwrite = 0; job->data = data; job->next = JobList; - job->donefn = donefn; if (JobList) JobList->prev = job; JobList = job; /* register watch events for file descriptors */ @@ -249,9 +246,9 @@ static int execute(char** cmd, Proc* proc) { close(inpipe[PIPE_READ]); close(outpipe[PIPE_WRITE]); close(errpipe[PIPE_WRITE]); - proc->in = inpipe[PIPE_WRITE]; - proc->out = outpipe[PIPE_READ]; - proc->err = errpipe[PIPE_READ]; + proc->in = inpipe[PIPE_WRITE]; + proc->out = outpipe[PIPE_READ]; + proc->err = errpipe[PIPE_READ]; } return proc->pid; } diff --git a/lib/x11.c b/lib/x11.c index afd989b..5289fee 100644 --- a/lib/x11.c +++ b/lib/x11.c @@ -211,7 +211,7 @@ void x11_finish(void) { if (Selections[CLIPBOARD].text) { char* text = Selections[CLIPBOARD].text; size_t len = strlen(text); - exec_job((char*[]){ "xcpd", NULL }, text, len, NULL, NULL); + exec_job((char*[]){ "xcpd", NULL }, text, len, NULL); while (event_poll(100)); } } diff --git a/tide.c b/tide.c index 5380921..612c67d 100644 --- a/tide.c +++ b/tide.c @@ -77,13 +77,13 @@ static void cmd_exec(char* cmd) { /* execute the job */ if (op == '!') - free(input), exec_job(execcmd, NULL, 0, NULL, NULL); + free(input), exec_job(execcmd, NULL, 0, NULL); else if (op == '>') - exec_job(execcmd, input, len, tags, NULL); + exec_job(execcmd, input, len, tags); else if (op == '|' || op == ':') - exec_job(execcmd, input, len, edit, NULL); + exec_job(execcmd, input, len, edit); else - exec_job(execcmd, input, len, (op != '<' ? curr : edit), NULL); + exec_job(execcmd, input, len, (op != '<' ? curr : edit)); } static void cmd_execwitharg(char* cmd, char* arg) {