we do not need tasks. that's an overkill.
authorPierre Habouzit <madcoder@debian.org>
Sun, 4 Feb 2007 22:14:21 +0000 (23:14 +0100)
committerPierre Habouzit <madcoder@debian.org>
Sun, 4 Feb 2007 22:14:21 +0000 (23:14 +0100)
fix the build system

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Makefile
job.c
job.h
postfix.c

index d7a5422..d61d0a7 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -71,6 +71,6 @@ headers:
 $(PROGRAMS): $$(patsubst %.c,.%.o,$$($$@_SOURCES)) Makefile
        $(CC) -o $@ $(CFLAGS) $(filter %.o,$^) $(LDFLAGS) $($@_LIBADD) $(filter %.a,$^)
 
--include $(foreach p,$(PROGRAMS),$(patsubst %.c,%.d,$(filter %.c,$p_SOURCES)))
+-include $(foreach p,$(PROGRAMS),$(patsubst %.c,.%.d,$(filter %.c,$p_SOURCES)))
 
 ###########################################################################}}}
diff --git a/job.c b/job.c
index 12c450a..acf8294 100644 (file)
--- a/job.c
+++ b/job.c
@@ -66,8 +66,8 @@ DO_DELETE(job_t, job);
 void job_release(job_t **job)
 {
     if (*job) {
-        if ((*job)->task && (*job)->task->stop) {
-            (*job)->task->stop(*job);
+        if ((*job)->stop) {
+            (*job)->stop(*job);
         }
         job_delete(job);
     }
@@ -121,9 +121,10 @@ job_t *job_accept(job_t *listener, int state)
         return NULL;
     }
 
-    res        = job_new();
-    res->fd    = sock;
-    res->state = state;
-    res->task  = listener->task;
+    res          = job_new();
+    res->fd      = sock;
+    res->state   = state;
+    res->process = listener->process;
+    res->stop    = listener->stop;
     return job_register_fd(res);
 }
diff --git a/job.h b/job.h
index 388d8f3..45d3e89 100644 (file)
--- a/job.h
+++ b/job.h
@@ -60,19 +60,8 @@ enum smtp_state {
 
 typedef struct job_t   job_t;
 typedef struct jpriv_t jpriv_t;
-typedef struct task_t  task_t;
-typedef struct tpriv_t tpriv_t;
 typedef struct query_t query_t;
 
-struct task_t {
-    void (*start)(job_t *, query_t *);
-    void (*stop)(job_t *);
-    void (*cancel)(job_t *);
-    void (*process)(job_t *);
-
-    tpriv_t *tdata;
-};
-
 struct job_t {
     unsigned state : 6;
     unsigned done  : 1;
@@ -80,7 +69,9 @@ struct job_t {
 
     int fd;
 
-    task_t  *task;
+    void (*stop)(job_t *);
+    void (*process)(job_t *);
+
     jpriv_t *jdata;
 };
 
index 5155471..83d7c4d 100644 (file)
--- a/postfix.c
+++ b/postfix.c
@@ -45,10 +45,6 @@ struct jpriv_t {
     buffer_t obuf;
 };
 
-struct tpriv_t {
-    job_t *jobs;
-};
-
 void postfix_start(job_t *job, query_t *query)
 {
 }
@@ -92,6 +88,8 @@ void postfix_process(job_t *job)
         if (!strstr(job->jdata->ibuf.data, "\r\n\r\n"))
             return;
 
+        job->state &= ~JOB_READ;
+
         /* TODO: do the parse */
     }
 }