mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Use g_free instead of free where appropriate.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3964 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
f99447e9f8
commit
48a0c6064f
@ -102,8 +102,8 @@
|
|||||||
|
|
||||||
|
|
||||||
static int gen_logs = 1;
|
static int gen_logs = 1;
|
||||||
static FILE * trans_log = 0x0;
|
static FILE * trans_log = NULL;
|
||||||
static char * log_base_name = 0x0;
|
static char * log_base_name = NULL;
|
||||||
|
|
||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
@ -145,22 +145,20 @@ xaccOpenLog (void)
|
|||||||
/* tag each filename with a timestamp */
|
/* tag each filename with a timestamp */
|
||||||
timestamp = xaccDateUtilGetStampNow ();
|
timestamp = xaccDateUtilGetStampNow ();
|
||||||
|
|
||||||
filename = (char *) malloc (strlen (log_base_name) + 50);
|
filename = g_strconcat (log_base_name, ".", timestamp, ".log", NULL);
|
||||||
strcpy (filename, log_base_name);
|
|
||||||
strcat (filename, ".");
|
|
||||||
strcat (filename, timestamp);
|
|
||||||
strcat (filename, ".log");
|
|
||||||
|
|
||||||
trans_log = fopen (filename, "a");
|
trans_log = fopen (filename, "a");
|
||||||
if (!trans_log) {
|
if (!trans_log) {
|
||||||
int norr = errno;
|
int norr = errno;
|
||||||
printf ("Error: xaccOpenLog(): cannot open journal \n"
|
printf ("Error: xaccOpenLog(): cannot open journal \n"
|
||||||
"\t %d %s\n", norr, strerror (norr));
|
"\t %d %s\n", norr, strerror (norr));
|
||||||
free (filename);
|
|
||||||
free (timestamp);
|
g_free (filename);
|
||||||
|
g_free (timestamp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
free (filename);
|
|
||||||
|
g_free (filename);
|
||||||
g_free (timestamp);
|
g_free (timestamp);
|
||||||
|
|
||||||
/* use tab-separated fields */
|
/* use tab-separated fields */
|
||||||
@ -170,7 +168,6 @@ xaccOpenLog (void)
|
|||||||
"memo action reconciled " \
|
"memo action reconciled " \
|
||||||
"amount price date_reconciled\n");
|
"amount price date_reconciled\n");
|
||||||
fprintf (trans_log, "-----------------\n");
|
fprintf (trans_log, "-----------------\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
@ -182,7 +179,7 @@ xaccCloseLog (void)
|
|||||||
if (!trans_log) return;
|
if (!trans_log) return;
|
||||||
fflush (trans_log);
|
fflush (trans_log);
|
||||||
fclose (trans_log);
|
fclose (trans_log);
|
||||||
trans_log = 0x0;
|
trans_log = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************************\
|
/********************************************************************\
|
||||||
@ -213,8 +210,9 @@ xaccTransWriteLog (Transaction *trans, char flag)
|
|||||||
drecn = xaccDateUtilGetStamp (split->date_reconciled.tv_sec);
|
drecn = xaccDateUtilGetStamp (split->date_reconciled.tv_sec);
|
||||||
|
|
||||||
/* use tab-separated fields */
|
/* use tab-separated fields */
|
||||||
fprintf (trans_log, "%c %p/%p %s %s %s %s %s " \
|
fprintf (trans_log,
|
||||||
"%s %s %s %c %Ld/%Ld %Ld/%Ld %s\n",
|
"%c\t%p/%p\t%s\t%s\t%s\t%s\t%s\t"
|
||||||
|
"%s\t%s\t%s\t%c\t%Ld/%Ld\t%Ld/%Ld\t%s\n",
|
||||||
flag,
|
flag,
|
||||||
trans, split, /* trans+split make up unique id */
|
trans, split, /* trans+split make up unique id */
|
||||||
dnow ? dnow : "",
|
dnow ? dnow : "",
|
||||||
@ -230,12 +228,13 @@ xaccTransWriteLog (Transaction *trans, char flag)
|
|||||||
gnc_numeric_denom(split->damount),
|
gnc_numeric_denom(split->damount),
|
||||||
gnc_numeric_num(split->value),
|
gnc_numeric_num(split->value),
|
||||||
gnc_numeric_denom(split->value),
|
gnc_numeric_denom(split->value),
|
||||||
drecn ? drecn : ""
|
drecn ? drecn : "");
|
||||||
);
|
|
||||||
free (drecn);
|
g_free (drecn);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf (trans_log, "===== END\n");
|
fprintf (trans_log, "===== END\n");
|
||||||
|
|
||||||
g_free (dnow);
|
g_free (dnow);
|
||||||
g_free (dent);
|
g_free (dent);
|
||||||
g_free (dpost);
|
g_free (dpost);
|
||||||
|
Loading…
Reference in New Issue
Block a user