* MA 02111-1307, USA.
*/
+#define _GNU_SOURCE
#define NANOSECONDS_PER_SECOND 1000000000
#define CPU_FREQ 1e9
const unsigned int i);
// Functions specific to this module
-static void registerProcessingText() __attribute__((constructor (102)));
-
static unsigned int readTraceNb(FILE* testCase);
static void skipCommentLines(FILE* testCase);
/*
* Processing Module registering function
*/
-static void registerProcessingText()
+void registerProcessingText()
{
g_queue_push_tail(&processingModules, &processingModuleText);
}
return;
}
+ fclose(processingData->testCase);
+
if (syncState->stats && processingData->factors)
{
g_array_free(processingData->factors, TRUE);
*/
static void finalizeProcessingText(SyncState* const syncState)
{
- size_t len;
int retval;
unsigned int* seq;
GArray* factors;
syncState->processingData;
FILE* testCase= processingData->testCase;
char* line= NULL;
+ size_t bufLen;
seq= calloc(syncState->traceNb, sizeof(unsigned int));
skipCommentLines(testCase);
- retval= getline(&line, &len, testCase);
+ retval= getline(&line, &bufLen, testCase);
while(!feof(testCase))
{
unsigned int sender, receiver;
g_error(strerror(errno));
}
- if (line[len - 1] == '\n')
+ if (line[retval - 1] == '\n')
{
- line[len - 1]= '\0';
+ line[retval - 1]= '\0';
}
retval= sscanf(line, " %u %u %lf %lf %c", &sender, &receiver,
seq[sender]++;
skipCommentLines(testCase);
- retval= getline(&line, &len, testCase);
+ retval= getline(&line, &bufLen, testCase);
}
free(seq);
abort();
}
+ if (line)
+ {
+ free(line);
+ }
+
return result;
}