Move job struct into job.c.

This commit is contained in:
nicm
2018-08-23 15:45:05 +00:00
parent 55db3623bf
commit bceccc6b63
8 changed files with 141 additions and 97 deletions

View File

@ -191,8 +191,8 @@ static const char *format_lower[] = {
static void
format_job_update(struct job *job)
{
struct format_job *fj = job->data;
struct evbuffer *evb = job->event->input;
struct format_job *fj = job_get_data(job);
struct evbuffer *evb = job_get_event(job)->input;
char *line = NULL, *next;
time_t t;
@ -221,18 +221,19 @@ format_job_update(struct job *job)
static void
format_job_complete(struct job *job)
{
struct format_job *fj = job->data;
struct format_job *fj = job_get_data(job);
struct evbuffer *evb = job_get_event(job)->input;
char *line, *buf;
size_t len;
fj->job = NULL;
buf = NULL;
if ((line = evbuffer_readline(job->event->input)) == NULL) {
len = EVBUFFER_LENGTH(job->event->input);
if ((line = evbuffer_readline(evb)) == NULL) {
len = EVBUFFER_LENGTH(evb);
buf = xmalloc(len + 1);
if (len != 0)
memcpy(buf, EVBUFFER_DATA(job->event->input), len);
memcpy(buf, EVBUFFER_DATA(evb), len);
buf[len] = '\0';
} else
buf = line;