From: Ton V. <to...@us...> - 2010-01-07 01:03:10
|
Update of /cvsroot/nagios/nagios/common In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv22359/common Modified Files: comments.c downtime.c Log Message: Fixed deferred sorting of comments and downtimes. Added tests to prove sorting Index: downtime.c =================================================================== RCS file: /cvsroot/nagios/nagios/common/downtime.c,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** downtime.c 31 Dec 2009 12:42:29 -0000 1.48 --- downtime.c 7 Jan 2010 01:03:01 -0000 1.49 *************** *** 974,979 **** static int downtime_compar(const void *p1, const void *p2){ ! scheduled_downtime *d1 = (scheduled_downtime *)p1; ! scheduled_downtime *d2 = (scheduled_downtime *)p2; return (d1->start_time < d2->start_time) ? -1 : (d1->start_time - d2->start_time); } --- 974,979 ---- static int downtime_compar(const void *p1, const void *p2){ ! scheduled_downtime *d1 = *(scheduled_downtime **)p1; ! scheduled_downtime *d2 = *(scheduled_downtime **)p2; return (d1->start_time < d2->start_time) ? -1 : (d1->start_time - d2->start_time); } *************** *** 1000,1004 **** qsort((void *)array, i, sizeof(*array), downtime_compar); ! last_downtime = array[0]; for (i=1; i<unsorted_downtime;i++){ last_downtime->next = array[i]; --- 1000,1004 ---- qsort((void *)array, i, sizeof(*array), downtime_compar); ! scheduled_downtime_list = last_downtime = array[0]; for (i=1; i<unsorted_downtime;i++){ last_downtime->next = array[i]; Index: comments.c =================================================================== RCS file: /cvsroot/nagios/nagios/common/comments.c,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** comments.c 31 Dec 2009 12:42:29 -0000 1.28 --- comments.c 7 Jan 2010 01:03:01 -0000 1.29 *************** *** 547,552 **** static int comment_compar(const void *p1, const void *p2){ ! comment *c1 = (comment *)p1; ! comment *c2 = (comment *)p2; return (c1->comment_id < c2->comment_id) ? -1 : (c1->comment_id - c2->comment_id); } --- 547,552 ---- static int comment_compar(const void *p1, const void *p2){ ! comment *c1 = *(comment **)p1; ! comment *c2 = *(comment **)p2; return (c1->comment_id < c2->comment_id) ? -1 : (c1->comment_id - c2->comment_id); } *************** *** 573,577 **** qsort((void *)array, i, sizeof(*array), comment_compar); ! last_comment = array[0]; for (i=1; i<unsorted_comments;i++){ last_comment->next = array[i]; --- 573,577 ---- qsort((void *)array, i, sizeof(*array), comment_compar); ! comment_list = last_comment = array[0]; for (i=1; i<unsorted_comments;i++){ last_comment->next = array[i]; |