]> git.mdlowis.com Git - projs/tide.git/commitdiff
removed function pointer from job starting routine
authorMichael D. Lowis <mike@mdlowis.com>
Tue, 20 Mar 2018 02:21:27 +0000 (22:21 -0400)
committerMichael D. Lowis <mike@mdlowis.com>
Tue, 20 Mar 2018 02:21:27 +0000 (22:21 -0400)
inc/edit.h
lib/exec.c
lib/x11.c
tide.c

index 6cb1485130600859aa2891470957b46cafe81678..f3f47e71d570434458d4928c0a5653f5f6cec288 100644 (file)
@@ -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);
 
index b3e650a6647582699fb0ba38190a3c17b0fca29e..6072dd85818df87f2617bad7bc9ba11926e814ed 100644 (file)
@@ -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;
 }
index afd989bf47273cb87c58991b252c8e5b9363ff16..5289fee5a0b5037ab5843c09a05221dc609725f2 100644 (file)
--- 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 5380921a0b4b12afef8bc4f925cee08bbd56a2bf..612c67d5c4e1d8283938281ee4fd443c50fe9ea6 100644 (file)
--- 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) {