mirror of
https://github.com/mdbtools/mdbtools.git
synced 2025-04-05 20:31:00 +08:00
Replace malloc/free with g_malloc/g_free
This commit is contained in:
parent
680e997365
commit
f09f9438d3
@ -24,6 +24,14 @@ Thu Dec 30 19:26:01 CST 2004 Jeff Smith <whydoubt@yahoo.com>
|
||||
* src/gmdb/table_def.c:
|
||||
* src/gmdb2/debug.c:
|
||||
* src/gmdb2/table_def.c: Replace malloc/memset with g_malloc0
|
||||
* src/gmdb/debug.c:
|
||||
* src/gmdb/sql.c:
|
||||
* src/gmdb/table_data.c:
|
||||
* src/gmdb/table_export.c:
|
||||
* src/gmdb2/debug.c:
|
||||
* src/gmdb2/sql.c:
|
||||
* src/gmdb2/table_data.c:
|
||||
* src/gmdb2/table_export.c: Replace malloc/free with g_malloc/g_free
|
||||
|
||||
Thu Dec 30 06:36:25 CST 2004 Jeff Smith <whydoubt@yahoo.com>
|
||||
* include/mdbtools.h: Fix MdbSargTreeFunc's typedef
|
||||
|
@ -389,11 +389,11 @@ GtkCTreeNode *node, *container;
|
||||
int namelen;
|
||||
|
||||
namelen = fbuf[newbase];
|
||||
tmpstr = malloc(namelen + 1);
|
||||
tmpstr = g_malloc(namelen + 1);
|
||||
strncpy(tmpstr, &fbuf[newbase+1], namelen);
|
||||
tmpstr[namelen]=0;
|
||||
snprintf(str, 100, "Column %d: %s", i+1, tmpstr);
|
||||
free(tmpstr);
|
||||
g_free(tmpstr);
|
||||
node = gmdb_debug_add_item(dbug, container, str, newbase + 1, newbase + namelen);
|
||||
newbase += namelen + 1;
|
||||
}
|
||||
|
@ -112,9 +112,8 @@ gchar *titles[256];
|
||||
return;
|
||||
}
|
||||
for (i=0;i<sql->num_columns;i++) {
|
||||
bound_data[i] = (char *) malloc(MDB_BIND_SIZE);
|
||||
bound_data[i][0] = '\0';
|
||||
mdbsql_bind_column(sql, i+1, bound_data[i]);
|
||||
bound_data[i] = (char *) g_malloc0(MDB_BIND_SIZE);
|
||||
mdb_sql_bind_column(sql, i+1, bound_data[i]);
|
||||
sqlcol = g_ptr_array_index(sql->columns,i);
|
||||
titles[i] = sqlcol->name;
|
||||
}
|
||||
@ -132,7 +131,7 @@ gchar *titles[256];
|
||||
|
||||
/* free the memory used to bind */
|
||||
for (i=0;i<sql->num_columns;i++) {
|
||||
free(bound_data[i]);
|
||||
g_free(bound_data[i]);
|
||||
}
|
||||
|
||||
mdb_sql_reset(sql);
|
||||
|
@ -70,8 +70,7 @@ GMdbDataWindow *dataw = NULL;
|
||||
|
||||
for (i=0;i<table->num_cols;i++) {
|
||||
/* bind columns */
|
||||
bound_data[i] = (char *) malloc(MDB_BIND_SIZE);
|
||||
bound_data[i][0] = '\0';
|
||||
bound_data[i] = (char *) g_malloc0(MDB_BIND_SIZE);
|
||||
mdb_bind_column(table, i+1, bound_data[i], NULL);
|
||||
|
||||
/* display column titles */
|
||||
@ -87,7 +86,7 @@ GMdbDataWindow *dataw = NULL;
|
||||
|
||||
/* free the memory used to bind */
|
||||
for (i=0;i<table->num_cols;i++) {
|
||||
free(bound_data[i]);
|
||||
g_free(bound_data[i]);
|
||||
}
|
||||
|
||||
/* add this one to the window list */
|
||||
|
@ -105,8 +105,7 @@ char msg[100];
|
||||
|
||||
for (i=0;i<table->num_cols;i++) {
|
||||
/* bind columns */
|
||||
bound_data[i] = (char *) malloc(MDB_BIND_SIZE);
|
||||
bound_data[i][0] = '\0';
|
||||
bound_data[i] = (char *) g_malloc0(MDB_BIND_SIZE);
|
||||
mdb_bind_column(table, i+1, bound_data[i], NULL);
|
||||
|
||||
/* display column titles */
|
||||
@ -134,7 +133,7 @@ char msg[100];
|
||||
|
||||
/* free the memory used to bind */
|
||||
for (i=0;i<table->num_cols;i++) {
|
||||
free(bound_data[i]);
|
||||
g_free(bound_data[i]);
|
||||
}
|
||||
|
||||
fclose(outfile);
|
||||
|
@ -819,11 +819,11 @@ GtkTreeIter *node, *container;
|
||||
int namelen;
|
||||
|
||||
namelen = fbuf[newbase];
|
||||
tmpstr = malloc(namelen + 1);
|
||||
tmpstr = g_malloc(namelen + 1);
|
||||
strncpy(tmpstr, &fbuf[newbase+1], namelen);
|
||||
tmpstr[namelen]=0;
|
||||
snprintf(str, 100, "Column %d: %s", i+1, tmpstr);
|
||||
free(tmpstr);
|
||||
g_free(tmpstr);
|
||||
node = gmdb_debug_add_item(store, container, str, newbase + 1, newbase + namelen);
|
||||
newbase += namelen + 1;
|
||||
}
|
||||
@ -847,12 +847,12 @@ GtkTreeIter *node, *container;
|
||||
int namelen;
|
||||
|
||||
namelen = fbuf[newbase];
|
||||
tmpstr = malloc(namelen + 1);
|
||||
tmpstr = g_malloc(namelen + 1);
|
||||
strncpy(tmpstr, &fbuf[newbase+1], namelen);
|
||||
tmpstr[namelen]=0;
|
||||
snprintf(str, 100, "Index %d: %s", i+1, tmpstr);
|
||||
node = gmdb_debug_add_item(store, container, str, newbase+1, newbase+namelen);
|
||||
free(tmpstr);
|
||||
g_free(tmpstr);
|
||||
newbase += namelen + 1;
|
||||
}
|
||||
}
|
||||
|
@ -448,8 +448,7 @@ gmdb_sql_execute_cb(GtkWidget *w, GladeXML *xml)
|
||||
renderer = gtk_cell_renderer_text_new();
|
||||
|
||||
for (i=0;i<sql->num_columns;i++) {
|
||||
bound_data[i] = (char *) malloc(MDB_BIND_SIZE);
|
||||
bound_data[i][0] = '\0';
|
||||
bound_data[i] = (char *) g_malloc0(MDB_BIND_SIZE);
|
||||
mdb_sql_bind_column(sql, i+1, bound_data[i], NULL);
|
||||
sqlcol = g_ptr_array_index(sql->columns,i);
|
||||
column = gtk_tree_view_column_new_with_attributes(sqlcol->name, renderer, "text", i, NULL);
|
||||
@ -472,7 +471,7 @@ gmdb_sql_execute_cb(GtkWidget *w, GladeXML *xml)
|
||||
|
||||
/* free the memory used to bind */
|
||||
for (i=0;i<sql->num_columns;i++) {
|
||||
free(bound_data[i]);
|
||||
g_free(bound_data[i]);
|
||||
}
|
||||
|
||||
mdb_sql_reset(sql);
|
||||
|
@ -88,8 +88,7 @@ GMdbDataWindow *dataw = NULL;
|
||||
|
||||
for (i=0;i<table->num_cols;i++) {
|
||||
/* bind columns */
|
||||
bound_data[i] = (char *) malloc(MDB_BIND_SIZE);
|
||||
bound_data[i][0] = '\0';
|
||||
bound_data[i] = (char *) g_malloc0(MDB_BIND_SIZE);
|
||||
mdb_bind_column(table, i+1, bound_data[i], NULL);
|
||||
|
||||
/* display column titles */
|
||||
@ -110,7 +109,7 @@ GMdbDataWindow *dataw = NULL;
|
||||
|
||||
/* free the memory used to bind */
|
||||
for (i=0;i<table->num_cols;i++) {
|
||||
free(bound_data[i]);
|
||||
g_free(bound_data[i]);
|
||||
}
|
||||
|
||||
/* add this one to the window list */
|
||||
|
@ -188,8 +188,7 @@ int rows=0;
|
||||
|
||||
for (i=0;i<table->num_cols;i++) {
|
||||
/* bind columns */
|
||||
bound_data[i] = (char *) malloc(MDB_BIND_SIZE);
|
||||
bound_data[i][0] = '\0';
|
||||
bound_data[i] = (char *) g_malloc0(MDB_BIND_SIZE);
|
||||
mdb_bind_column(table, i+1, bound_data[i], NULL);
|
||||
|
||||
/* display column titles */
|
||||
@ -217,7 +216,7 @@ int rows=0;
|
||||
|
||||
/* free the memory used to bind */
|
||||
for (i=0;i<table->num_cols;i++) {
|
||||
free(bound_data[i]);
|
||||
g_free(bound_data[i]);
|
||||
}
|
||||
|
||||
fclose(outfile);
|
||||
|
Loading…
Reference in New Issue
Block a user