parent
4fe323c441
commit
f90377d34a
|
@ -36,5 +36,13 @@ Task *newTask(char *n, time_t c, time_t d, int p, uint64_t sp) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// for llist
|
// for llist
|
||||||
int cmpTask(Task *a, Task *b) { return strcmp(a->name, b->name); }
|
int cmpTask(void *a, void *b) {
|
||||||
int cmpEvent(Event *a, Event *b) { return cmpTask(a->task, b->task); }
|
Task *aa = (Task *)a;
|
||||||
|
Task *bb = (Task *)b;
|
||||||
|
return strcmp(aa->name, bb->name);
|
||||||
|
}
|
||||||
|
int cmpEvent(void *a, void *b) {
|
||||||
|
Event *aa = (Event *)a;
|
||||||
|
Event *bb = (Event *)b;
|
||||||
|
return cmpTask(aa->task, bb->task);
|
||||||
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ Task *newTask(char *n, time_t c, time_t d, int p, uint64_t sp);
|
||||||
/*
|
/*
|
||||||
* compare function for Task
|
* compare function for Task
|
||||||
*/
|
*/
|
||||||
int cmpTask(Task *a, Task *b);
|
int cmpTask(void *a, void *b);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Event struct contains task and planned time frame
|
* Event struct contains task and planned time frame
|
||||||
|
@ -53,7 +53,7 @@ Event *newEvent(Task *t, time_t s, time_t e, uint64_t sp);
|
||||||
/*
|
/*
|
||||||
* compare function for Event
|
* compare function for Event
|
||||||
*/
|
*/
|
||||||
int cmpEvent(Event *a, Event *b);
|
int cmpEvent(void *a, void *b);
|
||||||
|
|
||||||
int genPlan(Task *head);
|
int genPlan(Task *head);
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "db.h"
|
#include "db.h"
|
||||||
#include "iCal.h"
|
#include "iCal.h"
|
||||||
|
#include "llist.h"
|
||||||
#include "planner.h" // for subject and event structs
|
#include "planner.h" // for subject and event structs
|
||||||
#include "ui.h"
|
#include "ui.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -20,8 +21,15 @@ int main() {
|
||||||
//
|
//
|
||||||
printf("%s\n", ctime(&now));
|
printf("%s\n", ctime(&now));
|
||||||
|
|
||||||
|
llist *list1 = llistNew(t1, cmpTask);
|
||||||
|
|
||||||
|
llistAppend(list1, &t2);
|
||||||
|
|
||||||
|
llist *found = llistGet(list1, &t2);
|
||||||
|
|
||||||
serialize(t1);
|
serialize(t1);
|
||||||
serialize(&t2);
|
serialize(&t2);
|
||||||
|
serialize(found->data);
|
||||||
free(t1);
|
free(t1);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue