From a00149f6aeb2c16c4911e6df31ed94d398b768bd Mon Sep 17 00:00:00 2001 From: compudj Date: Tue, 13 Jul 2004 17:59:06 +0000 Subject: [PATCH] time_infinite const git-svn-id: http://ltt.polymtl.ca/svn@624 04897980-b3bd-0310-b5e0-8ef037075253 --- ltt/branches/poly/ltt/event.c | 22 ++++++++++++++++++++-- ltt/branches/poly/ltt/time.h | 3 +++ ltt/branches/poly/ltt/tracefile.c | 5 +++-- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/ltt/branches/poly/ltt/event.c b/ltt/branches/poly/ltt/event.c index a7772d5d..7743cc9b 100644 --- a/ltt/branches/poly/ltt/event.c +++ b/ltt/branches/poly/ltt/event.c @@ -263,6 +263,7 @@ void ltt_event_position_set(LttEventPosition *ep, /***************************************************************************** * Function name * ltt_event_position_compare : compare two positions + * A NULL value is infinite. * Input params * ep1 : a pointer to event's position structure * ep2 : a pointer to event's position structure @@ -278,6 +279,13 @@ gint ltt_event_position_compare(const LttEventPosition *ep1, { if(ep1->tf != ep2->tf) g_error("ltt_event_position_compare on different tracefiles makes no sense"); + if(ep1 == NULL && ep2 == NULL) + return 0; + if(ep1 != NULL && ep2 == NULL) + return -1; + if(ep1 == NULL && ep2 != NULL) + return 1; + if(ep1->block_num < ep2->block_num) return -1; if(ep1->block_num > ep2->block_num) @@ -305,8 +313,15 @@ gint ltt_event_position_compare(const LttEventPosition *ep1, gint ltt_event_event_position_compare(const LttEvent *event, const LttEventPosition *ep) { - g_assert(event->tracefile == ep->tf); + if(event == NULL && ep == NULL) + return 0; + if(event != NULL && ep == NULL) + return -1; + if(event == NULL && ep != NULL) + return 1; + g_assert(event->tracefile == ep->tf); + if(event->which_block < ep->block_num) return -1; if(event->which_block > ep->block_num) @@ -330,7 +345,10 @@ gint ltt_event_event_position_compare(const LttEvent *event, void ltt_event_position_copy(LttEventPosition *dest, const LttEventPosition *src) { - *dest = *src; + if(src == NULL) + dest = NULL; + else + *dest = *src; } diff --git a/ltt/branches/poly/ltt/time.h b/ltt/branches/poly/ltt/time.h index 2cce2760..dc1cb220 100644 --- a/ltt/branches/poly/ltt/time.h +++ b/ltt/branches/poly/ltt/time.h @@ -19,6 +19,8 @@ #ifndef LTT_TIME_H #define LTT_TIME_H +#include + typedef struct _LttTime { unsigned long tv_sec; @@ -30,6 +32,7 @@ static const unsigned long NANOSECONDS_PER_SECOND = 1000000000; static const LttTime ltt_time_zero = { 0, 0}; +static const LttTime ltt_time_infinite = { G_MAXUINT, G_MAXUINT }; static inline LttTime ltt_time_sub(LttTime t1, LttTime t2) { diff --git a/ltt/branches/poly/ltt/tracefile.c b/ltt/branches/poly/ltt/tracefile.c index 493ba559..efda5ce4 100644 --- a/ltt/branches/poly/ltt/tracefile.c +++ b/ltt/branches/poly/ltt/tracefile.c @@ -526,7 +526,8 @@ LttTrace *ltt_trace_open(const char *pathname) } //get control tracefile info - + getControlFileInfo(t,control); + /* if(getControlFileInfo(t,control)) { g_ptr_array_free(t->facilities, TRUE); g_ptr_array_free(t->per_cpu_tracefiles, TRUE); @@ -535,7 +536,7 @@ LttTrace *ltt_trace_open(const char *pathname) g_free(t->pathname); g_free(t); return NULL; - } + }*/ // With fatal error //get cpu tracefile info if(getCpuFileInfo(t,cpu)) { -- 2.34.1