r16293 - gnucash/branches/csv-import/src/import-export/csv - Replaced calls to g_malloc with g_new
Benjamin Sperisen
lasindi at cvs.gnucash.org
Tue Jul 10 05:43:42 EDT 2007
Author: lasindi
Date: 2007-07-10 05:43:41 -0400 (Tue, 10 Jul 2007)
New Revision: 16293
Trac: http://svn.gnucash.org/trac/changeset/16293
Modified:
gnucash/branches/csv-import/src/import-export/csv/gnc-csv-import.c
gnucash/branches/csv-import/src/import-export/csv/gnc-csv-model.c
Log:
Replaced calls to g_malloc with g_new
Modified: gnucash/branches/csv-import/src/import-export/csv/gnc-csv-import.c
===================================================================
--- gnucash/branches/csv-import/src/import-export/csv/gnc-csv-import.c 2007-07-10 09:28:24 UTC (rev 16292)
+++ gnucash/branches/csv-import/src/import-export/csv/gnc-csv-import.c 2007-07-10 09:43:41 UTC (rev 16293)
@@ -356,7 +356,7 @@
static GncCsvPreview* gnc_csv_preview_new()
{
int i;
- GncCsvPreview* preview = g_malloc(sizeof(GncCsvPreview));
+ GncCsvPreview* preview = g_new(GncCsvPreview, 1);
GtkWidget *ok_button, *cancel_button;
GtkContainer* date_format_container;
/* The names in the glade file for the sep buttons. */
@@ -477,7 +477,7 @@
int i, j, ncols = preview->parse_data->column_types->len;
/* store contains only strings. */
- GType* types = g_malloc(2 * ncols * sizeof(GType));
+ GType* types = g_new(GType, 2 * ncols);
for(i = 0; i < ncols; i++)
types[i] = G_TYPE_STRING;
store = gtk_list_store_newv(ncols, types);
@@ -494,7 +494,7 @@
g_free(types);
/* Each element in cstores is a single column model. */
- cstores = g_malloc(ncols * sizeof(GtkListStore*));
+ cstores = g_new(GtkListStore*, ncols);
for(i = 0; i < ncols; i++)
{
cstores[i] = gtk_list_store_new(1, G_TYPE_STRING);
Modified: gnucash/branches/csv-import/src/import-export/csv/gnc-csv-model.c
===================================================================
--- gnucash/branches/csv-import/src/import-export/csv/gnc-csv-model.c 2007-07-10 09:28:24 UTC (rev 16292)
+++ gnucash/branches/csv-import/src/import-export/csv/gnc-csv-model.c 2007-07-10 09:43:41 UTC (rev 16293)
@@ -75,7 +75,7 @@
*/
GncCsvParseData* gnc_csv_new_parse_data(void)
{
- GncCsvParseData* parse_data = g_malloc(sizeof(GncCsvParseData));
+ GncCsvParseData* parse_data = g_new(GncCsvParseData, 1);
parse_data->encoding = "UTF-8";
/* All of the data pointers are initially NULL. This is so that, if
* gnc_csv_parse_data_free is called before all of the data is
@@ -332,7 +332,7 @@
*/
static TransProperty* trans_property_new(int type, TransPropertyList* set)
{
- TransProperty* prop = g_malloc(sizeof(TransProperty));
+ TransProperty* prop = g_new(TransProperty, 1);
prop->type = type;
prop->set = set;
@@ -379,7 +379,7 @@
switch(prop->type)
{
case GNC_CSV_DATE:
- prop->value = g_malloc(sizeof(time_t));
+ prop->value = g_new(time_t, 1);
*((time_t*)(prop->value)) = parse_date(str, prop->set->date_format);
return *((time_t*)(prop->value)) != -1;
@@ -389,7 +389,7 @@
case GNC_CSV_AMOUNT:
value = strtod(str, &endptr);
- prop->value = g_malloc(sizeof(gnc_numeric));
+ prop->value = g_new(gnc_numeric, 1);
/* If this isn't a valid numeric string, this is an error. */
if(endptr != str + strlen(str))
@@ -582,7 +582,7 @@
}
else
{
- GncCsvTransLine* trans_line = g_malloc(sizeof(GncCsvTransLine));
+ GncCsvTransLine* trans_line = g_new(GncCsvTransLine, 1);
trans_line->trans = trans;
trans_line->line_no = i;
More information about the gnucash-changes
mailing list