added edg_wll_SortPEvents
authorJan Pospíšil <honik@ntc.zcu.cz>
Fri, 1 Sep 2006 06:47:20 +0000 (06:47 +0000)
committerJan Pospíšil <honik@ntc.zcu.cz>
Fri, 1 Sep 2006 06:47:20 +0000 (06:47 +0000)
org.glite.lb.server/src/get_events.h
org.glite.lb.server/src/jobstat_supp.c
org.glite.lb.server/src/lb_plugin.c

index eee4e89..e3b6976 100644 (file)
@@ -19,12 +19,15 @@ int compare_events_by_tv(const void *, const void *);
 #endif
 
 int edg_wll_get_event_flesh(edg_wll_Context,int,edg_wll_Event *);
+
 int edg_wll_QueryEventsServer(edg_wll_Context,int,const edg_wll_QueryRec **,const edg_wll_QueryRec **,edg_wll_Event **);
 
 int edg_wll_QueryJobsServer(edg_wll_Context, const edg_wll_QueryRec **, int, edg_wlc_JobId **, edg_wll_JobStat **);
 
 void edg_wll_SortEvents(edg_wll_Event *);
 
+void edg_wll_SortPEvents(edg_wll_Event **);
+
 #ifdef __cplusplus
 }
 #endif
index 88ae42b..2261dcf 100644 (file)
@@ -760,8 +760,8 @@ int edg_wll_compare_seq(const char *a, const char *b)
 
 static int compare_events_by_seq(const void *a, const void *b)
 {
-        const edg_wll_Event *e = (edg_wll_Event *)a;
-        const edg_wll_Event *f = (edg_wll_Event *)b;
+        const edg_wll_Event *e = (edg_wll_Event *) a;
+        const edg_wll_Event *f = (edg_wll_Event *) b;
        int ret;
 
        ret = edg_wll_compare_seq(e->any.seqcode, f->any.seqcode);
@@ -774,13 +774,33 @@ static int compare_events_by_seq(const void *a, const void *b)
        return 0;
 }
 
+static int compare_pevents_by_seq(const void *a, const void *b)
+{
+        const edg_wll_Event **e = (edg_wll_Event **) a;
+        const edg_wll_Event **f = (edg_wll_Event **) b;
+       return compare_events_by_seq(*e,*f);
+}
+
 void edg_wll_SortEvents(edg_wll_Event *e)
 {
        int     n;
 
        if (!e) return;
        for (n=0; e[n].type; n++);
-       qsort(e,n,sizeof *e,compare_events_by_seq);
+       qsort(e,n,sizeof(*e),compare_events_by_seq);
+}
+
+void edg_wll_SortPEvents(edg_wll_Event **e)
+{
+       edg_wll_Event **p;
+       int     n;
+
+       if (!e) return;
+       p = e;
+       for (n=0; *p; n++) {
+               p++;
+       }
+       qsort(e,n,sizeof(*e),compare_pevents_by_seq);
 }
 
 
index c868931..ac02e4b 100644 (file)
@@ -498,9 +498,7 @@ static int lb_status(edg_wll_Event **events, edg_wll_JobStat *status) {
         js = calloc(1, sizeof(intJobStat));
        init_intJobStat(js);
 
-       /* TODO:
-       edg_wll_SortEvents(events);
-        */
+       edg_wll_SortPEvents(events);
 
        i = 0;
         while (events[i])