gnome-utils r8236 - trunk/logview
- From: cosimoc svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-utils r8236 - trunk/logview
- Date: Tue, 23 Dec 2008 13:25:44 +0000 (UTC)
Author: cosimoc
Date: Tue Dec 23 13:25:44 2008
New Revision: 8236
URL: http://svn.gnome.org/viewvc/gnome-utils?rev=8236&view=rev
Log:
Fix a leak in the date parsing code and rework variables to something
human.
Modified:
trunk/logview/logview-utils.c
Modified: trunk/logview/logview-utils.c
==============================================================================
--- trunk/logview/logview-utils.c (original)
+++ trunk/logview/logview-utils.c Tue Dec 23 13:25:44 2008
@@ -93,14 +93,13 @@
GSList *
log_read_dates (const char **buffer_lines, time_t current)
{
- int offsetyear = 0, current_year;
- GSList *days = NULL, *days_copy;
+ int current_year, offsetyear, i, n, rangemin, rangemax;
+ GSList *days = NULL;
GDate *date, *newdate;
struct tm *tmptm;
char *date_string;
Day *day;
gboolean done = FALSE;
- int i, n, rangemin, rangemax, idx;
g_return_val_if_fail (buffer_lines != NULL, NULL);
@@ -108,6 +107,7 @@
tmptm = localtime (¤t);
current_year = tmptm->tm_year + 1900;
+ offsetyear = 0;
/* find the first line with a date we're able to parse */
for (i = 0; buffer_lines[i]; i++) {
@@ -174,6 +174,7 @@
}
g_free (date_string);
+ date_string = NULL;
if (!done) {
/* this means we finished the current day but we're not at the end
@@ -206,6 +207,7 @@
* so it means that newdate is the next year.
*/
g_date_add_years (newdate, 1);
+ offsetyear++;
}
date = newdate;
@@ -221,6 +223,10 @@
}
}
+ if (date_string) {
+ g_free (date_string);
+ }
+
/* sort the days in chronological order */
days = g_slist_sort (days, days_compare);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]