Commit 9952bc0c authored by Michael Rouse's avatar Michael Rouse

Method for cleaning up after a report generation

parent ccc7bf4d
......@@ -185,6 +185,7 @@ static void perform_report_action(args_t args)
printf("%s: %0.2f\n", report->Entries[i].Date, report->Entries[i].Hours);
}
TimeSlime_FreeReport(&report);
}
......
......@@ -290,6 +290,16 @@ TIMESLIME_STATUS_t TimeSlime_GetReport(TIMESLIME_DATE_t start, TIMESLIME_DATE_t
return TIMESLIME_OK;
}
/* Frees memory allocated for report used in report method */
void TimeSlime_FreeReport(TIMESLIME_REPORT_t **report)
{
if (*report != NULL)
{
free(*report);
*report = NULL;
}
}
/**
* Converts status to friendly status code (or returns SQLITE error string)
*/
......
......@@ -102,10 +102,14 @@ TIMESLIME_STATUS_t TimeSlime_ClockOut(TIMESLIME_DATETIME_t time);
/* Gets the time sheet for a period of time */
TIMESLIME_STATUS_t TimeSlime_GetReport(TIMESLIME_DATE_t start, TIMESLIME_DATE_t end, TIMESLIME_REPORT_t **out);
/* Frees memory allocated for report used in report method */
void TimeSlime_FreeReport(TIMESLIME_REPORT_t **report);
/* Converts status to friendly error code (or returns SQLITE error string) */
char* TimeSlime_StatusCode(TIMESLIME_STATUS_t status);
/* Queries (Do not touch) */
#define __TS_QRY_GET_COMPLTED_CLOCK_ENTRIES "(ClockInTime IS NOT NULL AND ClockOutTime IS NOT NULL)"
#define __TS_QRY_GET_PARTIAL_CLOCK_ENTRIES "(ClockOutTime IS NULL AND ClockInTime IS NOT NULL)"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment