mirror of
https://github.com/Gnucash/gnucash.git
synced 2024-11-23 01:16:43 -06:00
Fix memory leaks due to localtime -> gnc_localtime replacement in r22618, r22626, r22627
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22829 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
ab0879d034
commit
c50b91505a
@ -577,7 +577,7 @@ static char * get_date_help (VirtualLocation virt_loc, gpointer user_data)
|
||||
GncEntryLedger *ledger = user_data;
|
||||
BasicCell *cell;
|
||||
char string[1024];
|
||||
struct tm *tm;
|
||||
struct tm tm;
|
||||
Timespec ts;
|
||||
time64 tt;
|
||||
|
||||
@ -590,8 +590,8 @@ static char * get_date_help (VirtualLocation virt_loc, gpointer user_data)
|
||||
|
||||
gnc_date_cell_get_date ((DateCell *) cell, &ts);
|
||||
tt = ts.tv_sec;
|
||||
tm = gnc_localtime (&tt);
|
||||
qof_strftime (string, sizeof(string), "%A %d %B %Y", tm);
|
||||
gnc_localtime_r (&tt, &tm);
|
||||
qof_strftime (string, sizeof(string), "%A %d %B %Y", &tm);
|
||||
|
||||
return g_strdup (string);
|
||||
}
|
||||
|
@ -179,15 +179,15 @@ main(void)
|
||||
{
|
||||
int y, m, d;
|
||||
time64 bin_time;
|
||||
struct tm *br_time;
|
||||
struct tm br_time;
|
||||
|
||||
gnc_time (&bin_time);
|
||||
br_time = gnc_localtime (&bin_time);
|
||||
gnc_localtime_r (&bin_time, &br_time);
|
||||
|
||||
gregorian_to_jalali(&y, &m, &d,
|
||||
1900 + br_time->tm_year,
|
||||
1 + br_time->tm_mon,
|
||||
br_time->tm_mday);
|
||||
1900 + br_time.tm_year,
|
||||
1 + br_time.tm_mon,
|
||||
br_time.tm_mday);
|
||||
|
||||
printf("Current Jalali date: %d %s %d\n", d, j_month_name[m-1], y);
|
||||
|
||||
|
@ -907,7 +907,7 @@ gnc_split_register_get_date_help (VirtualLocation virt_loc,
|
||||
SplitRegister *reg = user_data;
|
||||
BasicCell *cell;
|
||||
char string[1024];
|
||||
struct tm *tm;
|
||||
struct tm tm;
|
||||
Timespec ts;
|
||||
time64 tt;
|
||||
|
||||
@ -918,9 +918,9 @@ gnc_split_register_get_date_help (VirtualLocation virt_loc,
|
||||
gnc_date_cell_get_date ((DateCell *) cell, &ts);
|
||||
tt = ts.tv_sec;
|
||||
|
||||
tm = gnc_localtime (&tt);
|
||||
gnc_localtime_r (&tt, &tm);
|
||||
|
||||
qof_strftime (string, sizeof (string), "%A %d %B %Y", tm);
|
||||
qof_strftime (string, sizeof (string), "%A %d %B %Y", &tm);
|
||||
|
||||
return g_strdup (string);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user